Shopify/better-html

ERB parser crashes on multiple CDATA blocks

Closed this issue · 2 comments

Reproduce with:

require 'better_html'
require 'better_html/parser'
b = Parser::Source::Buffer.new('(buffer)');
b.source = '<![CDATA[foo]]><![CDATA[bar]]>'
BetterHtml::Parser.new(b).inspect

Result:

RuntimeError: Unhandled token cdata_end line 1 column 27, [s(:cdata, "foo"), s(:text, "<![CDATA[bar")]
from better_html-1.0.16/lib/better_html/parser.rb:79:in `build_document_node'

The problem is in html_tokenizer and a PR with a fix available: https://github.com/EiNSTeiN-/html_tokenizer/pull/7

Now that HtmlTokenizer was inlined in this gem, can you please submit your PR here instead?