summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2015-12-24 14:57:34 +0100
committerKornelius Kalnbach <murphy@rubychan.de>2015-12-24 14:57:34 +0100
commite93cdf6cc6b8fb9179fa82a1f9bad77eae1e9830 (patch)
tree71d532341f1e5603fadd8a3e880c346f77ae72d3
parent7aa6ea080d05b7e6a70b076b25f37b72fd7669ad (diff)
parentcb18c6af5f53cba503fb9704ce656596ae3db075 (diff)
downloadcoderay-e93cdf6cc6b8fb9179fa82a1f9bad77eae1e9830.tar.gz
Merge branch 'master' into possible-speedups
-rwxr-xr-xbin/coderay2
-rw-r--r--lib/coderay/scanners/diff.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/bin/coderay b/bin/coderay
index 889ae72..130a50b 100755
--- a/bin/coderay
+++ b/bin/coderay
@@ -35,7 +35,7 @@ defaults:
common:
coderay file.rb # highlight file to terminal
- coderay file.rb > file.html # highlight file to HTML page
+ coderay file.rb -page > file.html # highlight file to HTML page
coderay file.rb -div > file.html # highlight file to HTML snippet
configure output:
diff --git a/lib/coderay/scanners/diff.rb b/lib/coderay/scanners/diff.rb
index fd1aed6..74a6c27 100644
--- a/lib/coderay/scanners/diff.rb
+++ b/lib/coderay/scanners/diff.rb
@@ -100,7 +100,7 @@ module Scanners
next
elsif match = scan(/-/)
deleted_lines_count += 1
- if options[:inline_diff] && deleted_lines_count == 1 && (changed_lines_count = 1 + check(/.*(?:\n\-.*)*/).count("\n")) && match?(/(?>.*(?:\n\-.*){#{changed_lines_count - 1}}(?:\n\+.*){#{changed_lines_count}})$(?!\n\+)/)
+ if options[:inline_diff] && deleted_lines_count == 1 && (changed_lines_count = 1 + check(/.*(?:\n\-.*)*/).count("\n")) && changed_lines_count <= 100_000 && match?(/(?>.*(?:\n\-.*){#{changed_lines_count - 1}}(?:\n\+.*){#{changed_lines_count}})$(?!\n\+)/)
deleted_lines = Array.new(changed_lines_count) { |i| skip(/\n\-/) if i > 0; scan(/.*/) }
inserted_lines = Array.new(changed_lines_count) { |i| skip(/\n\+/) ; scan(/.*/) }