mirror of
https://github.com/russross/blackfriday.git
synced 2024-03-22 13:40:34 +08:00
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
|
||||
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
|
||||
|
|
|
@ -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
Block a user