parser no longer returns prematurely from empty footnote ref
This commit is contained in:
parent
4513607d62
commit
3ea84a5811
18
inline.go
18
inline.go
|
@ -481,15 +481,17 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
||||||
}
|
}
|
||||||
|
|
||||||
var uLink []byte
|
var uLink []byte
|
||||||
if len(link) > 0 {
|
if t == linkNormal || t == linkImg {
|
||||||
var uLinkBuf bytes.Buffer
|
if len(link) > 0 {
|
||||||
unescapeText(&uLinkBuf, link)
|
var uLinkBuf bytes.Buffer
|
||||||
uLink = uLinkBuf.Bytes()
|
unescapeText(&uLinkBuf, link)
|
||||||
}
|
uLink = uLinkBuf.Bytes()
|
||||||
|
}
|
||||||
|
|
||||||
// links need something to click on and somewhere to go
|
// links need something to click on and somewhere to go
|
||||||
if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) {
|
if len(uLink) == 0 || (t == linkNormal && content.Len() == 0) {
|
||||||
return 0
|
return 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// call the relevant rendering function
|
// call the relevant rendering function
|
||||||
|
|
|
@ -635,6 +635,9 @@ what happens here
|
||||||
</ol>
|
</ol>
|
||||||
</div>
|
</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)
|
doTestsInlineParam(t, tests, EXTENSION_FOOTNOTES, 0)
|
||||||
|
|
|
@ -508,7 +508,9 @@ func isReference(p *parser, data []byte, tabSize int) int {
|
||||||
|
|
||||||
// id matches are case-insensitive
|
// id matches are case-insensitive
|
||||||
id := string(bytes.ToLower(data[idOffset:idEnd]))
|
id := string(bytes.ToLower(data[idOffset:idEnd]))
|
||||||
|
|
||||||
p.refs[id] = ref
|
p.refs[id] = ref
|
||||||
|
|
||||||
return lineEnd
|
return lineEnd
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue