bhollis / maruku

A pure-Ruby Markdown-superset interpreter (Official Repo).
MIT License
500 stars 80 forks source link

HTML is sometimes interpreted after unescaping entities #85

Closed kentonv closed 11 years ago

kentonv commented 11 years ago

The current trunk code appears to have regressed from 0.6.1 when given this input:

echo '<pre><span class="cp">#inclued &lt;foo.h&gt;</span></pre>' | maruku

It seems to un-escape the HTML entities, and then go back and try to interpret the resulting text as HTML:

 ___________________________________________________________________________
| Maruku tells you:
+---------------------------------------------------------------------------
| Malformed HTML starting at "<foo.h>"
| ---------------------------------------------------------------------------
| #inclued <foo.h>EOF
| ---------|------------------------------------------------------------------
|          +--- Byte 9
| Shown bytes [0 to 16] of 16:
| >#inclued <foo.h>
| 
| Elements read in span: 
|  -
| Current string: 
|   "#inclued "
|
+---------------------------------------------------------------------------
!/var/lib/gems/1.9.1/gems/maruku-0.7.0.beta1/lib/maruku/input/parse_span.rb:424:in `read_inline_html'
!/var/lib/gems/1.9.1/gems/maruku-0.7.0.beta1/lib/maruku/input/parse_span.rb:93:in `read_span'
!/var/lib/gems/1.9.1/gems/maruku-0.7.0.beta1/lib/maruku/input/parse_span.rb:14:in `parse_span'
!/var/lib/gems/1.9.1/gems/maruku-0.7.0.beta1/lib/maruku/input/parse_doc.rb:175:in `block (3 levels) in substitute_markdown_inside_raw_html'
\___________________________________________________________________________
distler commented 11 years ago

The current trunk code appears to have regressed from 0.6.1

Correct.

This is one of several bugfixes in my (ill-named) pull request. It's fixed on my math-enabled branch of Maruku.

distler commented 11 years ago

Hmmm. It seems that I have problems, too, when the entities are in inline spans...

Grrrr.....

distler commented 11 years ago

Fixed, now.

kentonv commented 11 years ago

Thanks!

distler commented 11 years ago

Fix is now on trunk.