mirror of
https://github.com/danog/blackfriday.git
synced 2024-11-27 04:24:41 +01:00
Merge pull request #159 from rtfb/sequential-footnotes
Fix recognition of consecutive footnotes
This commit is contained in:
commit
3a90da10e3
@ -348,7 +348,7 @@ func link(p *parser, out *bytes.Buffer, data []byte, offset int) int {
|
||||
i++
|
||||
|
||||
// reference style link
|
||||
case i < len(data) && data[i] == '[':
|
||||
case i < len(data)-1 && data[i] == '[' && data[i+1] != '^':
|
||||
var id []byte
|
||||
|
||||
// look for the id
|
||||
|
@ -805,6 +805,12 @@ what happens here
|
||||
|
||||
"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",
|
||||
|
||||
"Some text.[^note1]\n\n[^note1]: fn1",
|
||||
"<p>Some text.<sup class=\"footnote-ref\" id=\"fnref:note1\"><a rel=\"footnote\" href=\"#fn:note1\">1</a></sup></p>\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:note1\">fn1\n</li>\n</ol>\n</div>\n",
|
||||
|
||||
"Some text.[^note1][^note2]\n\n[^note1]: fn1\n[^note2]: fn2\n",
|
||||
"<p>Some text.<sup class=\"footnote-ref\" id=\"fnref:note1\"><a rel=\"footnote\" href=\"#fn:note1\">1</a></sup><sup class=\"footnote-ref\" id=\"fnref:note2\"><a rel=\"footnote\" href=\"#fn:note2\">2</a></sup></p>\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:note1\">fn1\n</li>\n<li id=\"fn:note2\">fn2\n</li>\n</ol>\n</div>\n",
|
||||
}
|
||||
|
||||
func TestFootnotes(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user