tobijk / caius

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

Markdown: ampersand in autolinks #11

Closed wduquette closed 9 years ago

wduquette commented 9 years ago

Auto-linked URLs are not escaped. Per the mdtest test suite, the ampersand in the following

Auto-link with ampersand: <http://example.com/?foo=1&bar=2>

should be escaped. I fixed this in my code by adding the HtmlEscape line in this code:

                # HTML TAGS, COMMENTS AND AUTOLINKS
                if {[regexp -start $index $re_comment $text m]} {
                    append result $m
                    incr index [string length $m]
                    continue
                } elseif {[regexp -start $index $re_autolink $text m email link]} {
                    if {$link ne {}} {
                        set link [HtmlEscape $link]
                        append result "<a href=\"$link\">$link</a>"
                    } else {
...

For "HtmlEscape", read "html_escape".

tobijk commented 9 years ago

Thanks a lot for this. Fixed in 79113bef.