mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-26 20:14:43 +01:00
Don't require the input to end with a newline
Technically, not ending a line with a newline is wrong, but this blunder is so pervasive that we have no other choice but to live with it. Fixes #180.
This commit is contained in:
parent
e3cbadc5c9
commit
bcd6dd8711
@ -695,6 +695,9 @@ func TestReferenceLink(t *testing.T) {
|
|||||||
|
|
||||||
"[ref]\n [ref]: ../url/ \"title\"\n",
|
"[ref]\n [ref]: ../url/ \"title\"\n",
|
||||||
"<p><a href=\"../url/\" title=\"title\">ref</a></p>\n",
|
"<p><a href=\"../url/\" title=\"title\">ref</a></p>\n",
|
||||||
|
|
||||||
|
"[link][ref]\n [ref]: /url/",
|
||||||
|
"<p><a href=\"/url/\">link</a></p>\n",
|
||||||
}
|
}
|
||||||
doLinkTestsInline(t, tests)
|
doLinkTestsInline(t, tests)
|
||||||
}
|
}
|
||||||
|
@ -638,9 +638,6 @@ func scanLinkRef(p *parser, data []byte, i int) (linkOffset, linkEnd, titleOffse
|
|||||||
for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' {
|
for i < len(data) && data[i] != ' ' && data[i] != '\t' && data[i] != '\n' && data[i] != '\r' {
|
||||||
i++
|
i++
|
||||||
}
|
}
|
||||||
if i == len(data) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
linkEnd = i
|
linkEnd = i
|
||||||
if data[linkOffset] == '<' && data[linkEnd-1] == '>' {
|
if data[linkOffset] == '<' && data[linkEnd-1] == '>' {
|
||||||
linkOffset++
|
linkOffset++
|
||||||
|
Loading…
Reference in New Issue
Block a user