summaryrefslogtreecommitdiff
path: root/lib/coderay/scanners/html.rb
diff options
context:
space:
mode:
authorKornelius Kalnbach <murphy@rubychan.de>2013-06-23 14:36:53 +0200
committerKornelius Kalnbach <murphy@rubychan.de>2013-06-23 14:36:53 +0200
commit8c3c0c49a98eb8daceb69d0b233d054fbbccc49e (patch)
tree52dfc1b4abe110580a51ec0c0d056d1044c44151 /lib/coderay/scanners/html.rb
parent7ada74c8f0f77815393e887db83e1d2c36ce7235 (diff)
parent9651f0b464b6540a1427ea8320abaa01caf197b3 (diff)
downloadcoderay-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.rb14
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