diff options
author | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-23 14:36:53 +0200 |
---|---|---|
committer | Kornelius Kalnbach <murphy@rubychan.de> | 2013-06-23 14:36:53 +0200 |
commit | 8c3c0c49a98eb8daceb69d0b233d054fbbccc49e (patch) | |
tree | 52dfc1b4abe110580a51ec0c0d056d1044c44151 /lib/coderay/scanners/html.rb | |
parent | 7ada74c8f0f77815393e887db83e1d2c36ce7235 (diff) | |
parent | 9651f0b464b6540a1427ea8320abaa01caf197b3 (diff) | |
download | coderay-8c3c0c49a98eb8daceb69d0b233d054fbbccc49e.tar.gz |
Merge branch 'master' into css-in-html
Diffstat (limited to 'lib/coderay/scanners/html.rb')
-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 f1dfba0..ebe7b01 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 = [ @@ -105,7 +105,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 |