all repos — grayfriday @ 3ea84a5811efb21f6663ea315a3dbe3425c6831e

blackfriday fork with a few changes

parser no longer returns prematurely from empty footnote ref
moshee moshee@displaynone.us
Mon, 08 Jul 2013 22:34:12 +0000
commit

3ea84a5811efb21f6663ea315a3dbe3425c6831e

parent

4513607d62924982900f4aa2c2857db045974b5a

3 files changed, 15 insertions(+), 8 deletions(-)

jump to
M inline.goinline.go

@@ -481,15 +481,17 @@ }

} var uLink []byte - if len(link) > 0 { - var uLinkBuf bytes.Buffer - unescapeText(&uLinkBuf, link) - uLink = uLinkBuf.Bytes() - } + if t == linkNormal || t == linkImg { + if len(link) > 0 { + var uLinkBuf bytes.Buffer + unescapeText(&uLinkBuf, link) + uLink = uLinkBuf.Bytes() + } - // links need something to click on and somewhere to go - if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) { - return 0 + // links need something to click on and somewhere to go + if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) { + return 0 + } } // call the relevant rendering function
M inline_test.goinline_test.go

@@ -635,6 +635,9 @@ <li id="fn:and-this-is-an-i">and this is an inline footnote</li>

</ol> </div> `, + + "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", } doTestsInlineParam(t, tests, EXTENSION_FOOTNOTES, 0)
M markdown.gomarkdown.go

@@ -508,7 +508,9 @@ }

// id matches are case-insensitive id := string(bytes.ToLower(data[idOffset:idEnd])) + p.refs[id] = ref + return lineEnd }