all repos — grayfriday @ ca8c21a297ad75731d76c97059f3a5231eb061f2

blackfriday fork with a few changes

Fix footnote following an exclamation point

Link parser interpreted the sequence "![^foo]" as an image, but if
footnote extension is enabled, it's quite clear that it should be
interpreted as a footnote following something with an exclamation point
at the end.

Closes #194.
Vytautas Ĺ altenis vytas@rtfb.lt
Tue, 03 Nov 2015 20:52:36 +0200
commit

ca8c21a297ad75731d76c97059f3a5231eb061f2

parent

660c9fd283952bff5f651d5b598de779fc9e1bfc

2 files changed, 21 insertions(+), 0 deletions(-)

jump to
M inline.goinline.go

@@ -212,6 +212,11 @@ // [^refId] == deferred footnote

var t linkType if offset > 0 && data[offset-1] == '!' { t = linkImg + // if footnotes extension is ON and we've seen "![^", then it's not an + // image, it's a deferred footnote: + if p.flags&EXTENSION_FOOTNOTES != 0 && len(data)-1 > offset && data[offset+1] == '^' { + t = linkDeferredFootnote + } } else if p.flags&EXTENSION_FOOTNOTES != 0 { if offset > 0 && data[offset-1] == '^' { t = linkInlineFootnote
M inline_test.goinline_test.go

@@ -969,6 +969,22 @@ </li>

</ol> </div> `, + + `This is exciting![^fn1] + +[^fn1]: Fine print +`, + `<p>This is exciting!<sup class="footnote-ref" id="fnref:fn1"><a rel="footnote" href="#fn:fn1">1</a></sup></p> +<div class="footnotes"> + +<hr /> + +<ol> +<li id="fn:fn1">Fine print +</li> +</ol> +</div> +`, } func TestFootnotes(t *testing.T) {