diff options
-rw-r--r-- | lib/coderay/scanners/html.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/coderay/scanners/html.rb b/lib/coderay/scanners/html.rb index 3ba3b79..530ce44 100644 --- a/lib/coderay/scanners/html.rb +++ b/lib/coderay/scanners/html.rb @@ -1,13 +1,13 @@ module CodeRay module Scanners - + # HTML Scanner # # Alias: +xhtml+ # # See also: Scanners::XML class HTML < Scanner - + register_for :html KINDS_NOT_LOC = [ @@ -99,7 +99,15 @@ module Scanners case state when :initial - if match = scan(/<!--(?:.*?-->|.*)/m) + if match = scan(/<!\[CDATA\[/) + encoder.text_token match, :inline_delimiter + if match = scan(/.*?\]\]>/m) + encoder.text_token match[0..-4], :plain + encoder.text_token ']]>', :inline_delimiter + elsif match = scan(/.+/) + encoder.text_token match, :error + end + elsif match = scan(/<!--(?:.*?-->|.*)/m) encoder.text_token match, :comment elsif match = scan(/<!(\w+)(?:.*?>|.*)|\]>/m) encoder.text_token match, :doctype |