all repos — grayfriday @ f2d43f69a49fc75aa738627de774597242072fc0

blackfriday fork with a few changes

Fix bug in autolink termination

Detect the end of link when it is immediately followed by an element.
Vytautas Ĺ altenis vytas@rtfb.lt
Sat, 25 Jan 2014 21:59:38 +0200
commit

f2d43f69a49fc75aa738627de774597242072fc0

parent

9fc8c9d8660c52c8390ba80e50556577e179b984

2 files changed, 8 insertions(+), 1 deletions(-)

jump to
M inline.goinline.go

@@ -654,7 +654,7 @@ return 0

} linkEnd := 0 - for linkEnd < len(data) && !isspace(data[linkEnd]) { + for linkEnd < len(data) && !isEndOfLink(data[linkEnd]) { linkEnd++ }

@@ -735,6 +735,10 @@ p.r.AutoLink(out, uLink.Bytes(), LINK_TYPE_NORMAL)

} return linkEnd - rewind +} + +func isEndOfLink(char byte) bool { + return isspace(char) || char == '<' } var validUris = [][]byte{[]byte("http://"), []byte("https://"), []byte("ftp://"), []byte("mailto://"), []byte("/")}
M inline_test.goinline_test.go

@@ -689,6 +689,9 @@ "<p>(<a href=\"http://www.fancy.com/A_B\">http://www.fancy.com/A_B</a> (</p>\n",

"(<a href=\"http://www.fancy.com/A_B\">http://www.fancy.com/A_B</a> (part two: <a href=\"http://www.fancy.com/A_B\">http://www.fancy.com/A_B</a>)).\n", "<p>(<a href=\"http://www.fancy.com/A_B\">http://www.fancy.com/A_B</a> (part two: <a href=\"http://www.fancy.com/A_B\">http://www.fancy.com/A_B</a>)).</p>\n", + + "http://www.foo.com<br />\n", + "<p><a href=\"http://www.foo.com\">http://www.foo.com</a><br /></p>\n", } doTestsInline(t, tests) }