From a4bd413ca4e835fd3d1fdc24eebce67cd54231ca Mon Sep 17 00:00:00 2001 From: murphy Date: Tue, 30 Sep 2008 16:42:53 +0000 Subject: 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. --- lib/coderay/encoder.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/coderay/encoder.rb') diff --git a/lib/coderay/encoder.rb b/lib/coderay/encoder.rb index ced0f6c..28b387b 100644 --- a/lib/coderay/encoder.rb +++ b/lib/coderay/encoder.rb @@ -133,7 +133,7 @@ module CodeRay # whether +text+ is a String. def token text, kind out = - if text.is_a? ::String # Ruby 1.9: :open.is_a? String + if text.is_a? ::String # Ruby 1.9: watch out, :open.is_a? String is true text_token text, kind elsif text.is_a? ::Symbol block_token text, kind @@ -152,6 +152,10 @@ module CodeRay open_token kind when :close close_token kind + when :begin_line + begin_line kind + when :end_line + end_line kind else raise 'unknown block action: %p' % action end -- cgit v1.2.1