tobijk / caius

A functional testing framework in object-oriented Tcl
MIT License
26 stars 5 forks source link

Failure to process html tag attributes bracketed by single-quotes #16

Closed andreas-kupries closed 9 years ago

andreas-kupries commented 9 years ago

The following test input where I used HTML in MD to get a nice table caused Caius to drop the second table from the output!

<table><tr>
<td>Array</td>
<td><a href='http://core.tcl.tk/akupries/array'>Core</a></td>
</tr></table>

<table><tr>
<td>Tcl</td>
<td><a href='http://core.tcl.tk/tcl'>Core</a></td>
</tr></table>

I found two ways of fixing this in the input: (1) Remove the column contain the reference. (2) Change the single-quotes around the href-url to double-quotes.

It seems that the processor chokes in some way on the single-quotes. As AFAIK HTML allows either single- or double-quotes around attribute values and markdown allows arbitrary HTML this looks to me a bug in the processor itself.

This looks to be line 325 in Tclssg's copy of markdown.tcl (proc "apply_templates", first occurence of "re_htmltag"). Replacing it with

set re_htmltag {<(/?)(\w+)(?:\s+\w+=(?:\"[^\"]+\"|'[^']+'))*\s*>}

and the problem was fixed. The new regex is based on the variation of the re_htmltag variable I found in line 431 (proc parse_inline) of the same file.

tobijk commented 9 years ago

Thanks a lot for reporting this. Fixed in 0.15.0.

andreas-kupries commented 9 years ago

Thank you.