summaryrefslogtreecommitdiff
path: root/lib/coderay/encoders/html
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2008-09-30 16:42:53 +0000
committermurphy <murphy@rubychan.de>2008-09-30 16:42:53 +0000
commita4bd413ca4e835fd3d1fdc24eebce67cd54231ca (patch)
tree518d0448cec8093f2f2be22a483535fc642de975 /lib/coderay/encoders/html
parenta1465d8bdf5637893c079d3a266b46b04e40d364 (diff)
downloadcoderay-a4bd413ca4e835fd3d1fdc24eebce67cd54231ca.tar.gz
New: *Simple Diff Scanner* (closes #22).
* Highlights unified diffs, especially like the ones svn diff outputs. * Changes to make highlighting of whole lines were necessary. * I added two example files. More changes: * Added token classes :head, :delete, :insert, and :change along with styles. * Added two new special token types: :begin_line and :end_line. They mark token groups that explicitly span whole lines and should be highlighted as such. * The HTML encoder converts these new tokens to DIVs. May need more work. * The Debug Encoder uses square brackets for line tokens. * Some cleanups.
Diffstat (limited to 'lib/coderay/encoders/html')
-rw-r--r--lib/coderay/encoders/html/numerization.rb4
-rw-r--r--lib/coderay/encoders/html/output.rb4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/coderay/encoders/html/numerization.rb b/lib/coderay/encoders/html/numerization.rb
index d784bbe..9f1667f 100644
--- a/lib/coderay/encoders/html/numerization.rb
+++ b/lib/coderay/encoders/html/numerization.rb
@@ -71,6 +71,7 @@ module Encoders
line_numbers.gsub!(/\n/) { "<tt>\n</tt>" }
line_numbers_table_tpl = TABLE.apply('LINE_NUMBERS', line_numbers)
+ gsub!(/<\/div>\n/) { '</div>' }
gsub!(/\n/) { "<tt>\n</tt>" }
wrap_in! line_numbers_table_tpl
@wrapped_in = :div
@@ -90,8 +91,9 @@ module Encoders
end
close = '</span>' * opened_tags.size
- "<li>#{open}#{line}#{close}</li>"
+ "<li>#{open}#{line}#{close}</li>\n"
end
+ chomp!("\n")
wrap_in! LIST
@wrapped_in = :div
diff --git a/lib/coderay/encoders/html/output.rb b/lib/coderay/encoders/html/output.rb
index e74e55e..8def95e 100644
--- a/lib/coderay/encoders/html/output.rb
+++ b/lib/coderay/encoders/html/output.rb
@@ -166,7 +166,9 @@ module Encoders
# title="double click to expand"
LIST = <<-`LIST`
-<ol class="CodeRay"><%CONTENT%></ol>
+<ol class="CodeRay">
+<%CONTENT%>
+</ol>
LIST
PAGE = <<-`PAGE`