parser no longer returns prematurely from empty footnote ref
This commit is contained in:
parent
4513607d62
commit
3ea84a5811
|
@ -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 {
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue