parser no longer returns prematurely from empty footnote ref

This commit is contained in:
moshee 2013-07-08 22:34:12 +00:00
parent 4513607d62
commit 3ea84a5811
3 changed files with 15 additions and 8 deletions

View File

@ -481,6 +481,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
}
var uLink []byte
if t == linkNormal || t == linkImg {
if len(link) > 0 {
var uLinkBuf bytes.Buffer
unescapeText(&uLinkBuf, link)
@ -491,6 +492,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) {
return 0
}
}
// call the relevant rendering function
switch t {

View File

@ -635,6 +635,9 @@ what happens here
</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)

View File

@ -508,7 +508,9 @@ func isReference(p *parser, data []byte, tabSize int) int {
// id matches are case-insensitive
id := string(bytes.ToLower(data[idOffset:idEnd]))
p.refs[id] = ref
return lineEnd
}