panic fix (issue #33) with test case
Russ Ross russ@dixie.edu
Wed, 11 Sep 2013 12:47:43 -0600
2 files changed,
4 insertions(+),
1 deletions(-)
M
inline.go
→
inline.go
@@ -181,7 +181,7 @@
// '[': parse a link or an image or a footnote func link(p *parser, out *bytes.Buffer, data []byte, offset int) int { // no links allowed inside regular links, footnote, and deferred footnotes - if p.insideLink && (data[offset-1] == '[' || data[offset+1] == '^') { + if p.insideLink && (offset > 0 && data[offset-1] == '[' || len(data)-1 > offset && data[offset+1] == '^') { return 0 }
M
inline_test.go
→
inline_test.go
@@ -410,6 +410,9 @@ "<p><a href=\"/url/\">link & ampersand</a></p>\n",
"[link](/url/&query)\n", "<p><a href=\"/url/&query\">link</a></p>\n", + + "[[t]](/t)\n", + "<p><a href=\"/t\">[t]</a></p>\n", } doTestsInline(t, tests) }