rubychan / coderay

Fast and easy syntax highlighting for selected languages, written in Ruby.
http://coderay.rubychan.de/
Other
847 stars 115 forks source link

Support CDATA blocks in HTML/XML #131

Closed Phrogz closed 11 years ago

Phrogz commented 11 years ago

Currently XML with CDATA blocks parses with an error:

<r><![CDATA[
  This is valid, but the open and close angle brackes are flagged as errors.
]]></r>

This pull request modifies the HTML scanner (since the XML scanner just defers to that) to add CDATA block scanning. The block is tagged with a :string group with the opening <![CDATA[ and closing ]]> marked as :delimiter and the contents as :content.

If a CDATA block starts but is never closed, all content following the opening delimiter are tagged with :error.

Phrogz commented 11 years ago

Whoops; I was trying to make a change request for just one commit, not the whole branch. Will close and create a new one :/