summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormurphy <murphy@rubychan.de>2010-07-14 22:31:17 +0000
committermurphy <murphy@rubychan.de>2010-07-14 22:31:17 +0000
commit93c4cd11c3b9349efbaac3ea51430123ca3b475e (patch)
tree55af0c0dd4505aaa0a022cef06a467534749e288 /lib
parentdfb0c922032ddaf9ddf5eb46a883f46715c0a50d (diff)
downloadcoderay-93c4cd11c3b9349efbaac3ea51430123ca3b475e.tar.gz
Fixing RHTML comments (#241).
Diffstat (limited to 'lib')
-rw-r--r--lib/coderay/scanners/rhtml.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/coderay/scanners/rhtml.rb b/lib/coderay/scanners/rhtml.rb
index 1922948..2403edf 100644
--- a/lib/coderay/scanners/rhtml.rb
+++ b/lib/coderay/scanners/rhtml.rb
@@ -48,12 +48,16 @@ module Scanners
@html_scanner.tokenize match, :tokens => encoder
elsif match = scan(/#{ERB_RUBY_BLOCK}/o)
- start_tag = match[/\A<%[-=]?/]
+ start_tag = match[/\A<%[-=#]?/]
end_tag = match[/-?%?>?\z/]
encoder.begin_group :inline
encoder.text_token start_tag, :inline_delimiter
code = match[start_tag.size .. -1 - end_tag.size]
- @ruby_scanner.tokenize code
+ if start_tag[/\A<%#/]
+ encoder.text_token code, :comment
+ else
+ @ruby_scanner.tokenize code
+ end unless code.empty?
encoder.text_token end_tag, :inline_delimiter unless end_tag.empty?
encoder.end_group :inline