all repos — grayfriday @ 195dac9f5b4031be2dfd529114a6191a1b512d31

blackfriday fork with a few changes

Fix recognition of consecutive footnotes

The second footnote was treated as if the pair of them were a reference
style link, without checking if the second bit is another footnote.

Fixes issue 158.
Vytautas Ĺ altenis vytas@rtfb.lt
Fri, 03 Apr 2015 21:05:54 +0300
commit

195dac9f5b4031be2dfd529114a6191a1b512d31

parent

2c0c546774078ef20c0cf4869b69e7528c03b003

2 files changed, 7 insertions(+), 1 deletions(-)

jump to
M inline.goinline.go

@@ -348,7 +348,7 @@

i++ // reference style link - case i < len(data) && data[i] == '[': + case i < len(data)-1 && data[i] == '[' && data[i+1] != '^': var id []byte // look for the id
M inline_test.goinline_test.go

@@ -805,6 +805,12 @@ `,

"empty footnote[^]\n\n[^]: fn text", "<p>empty footnote<sup class=\"footnote-ref\" id=\"fnref:\"><a rel=\"footnote\" href=\"#fn:\">1</a></sup></p>\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:\">fn text\n</li>\n</ol>\n</div>\n", + + "Some text.[^note1]\n\n[^note1]: fn1", + "<p>Some text.<sup class=\"footnote-ref\" id=\"fnref:note1\"><a rel=\"footnote\" href=\"#fn:note1\">1</a></sup></p>\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:note1\">fn1\n</li>\n</ol>\n</div>\n", + + "Some text.[^note1][^note2]\n\n[^note1]: fn1\n[^note2]: fn2\n", + "<p>Some text.<sup class=\"footnote-ref\" id=\"fnref:note1\"><a rel=\"footnote\" href=\"#fn:note1\">1</a></sup><sup class=\"footnote-ref\" id=\"fnref:note2\"><a rel=\"footnote\" href=\"#fn:note2\">2</a></sup></p>\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:note1\">fn1\n</li>\n<li id=\"fn:note2\">fn2\n</li>\n</ol>\n</div>\n", } func TestFootnotes(t *testing.T) {