parser no longer returns prematurely from empty footnote ref
moshee moshee@displaynone.us
Mon, 08 Jul 2013 22:34:12 +0000
3 files changed,
15 insertions(+),
8 deletions(-)
M
inline.go
→
inline.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.go
→
inline_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.go
→
markdown.go
@@ -508,7 +508,9 @@ }
// id matches are case-insensitive id := string(bytes.ToLower(data[idOffset:idEnd])) + p.refs[id] = ref + return lineEnd }