remove rel='footnote' which is not valid in html5

This commit is contained in:
Krzysztof Kowalczyk 2018-02-26 01:14:35 -08:00
parent 9059a41742
commit 7c15bc5850
2 changed files with 14 additions and 14 deletions

View File

@ -323,7 +323,7 @@ func (r *Renderer) outTag(w io.Writer, name string, attrs []string) {
func footnoteRef(prefix string, node *ast.Link) string { func footnoteRef(prefix string, node *ast.Link) string {
urlFrag := prefix + string(slugify(node.Destination)) urlFrag := prefix + string(slugify(node.Destination))
nStr := strconv.Itoa(node.NoteID) nStr := strconv.Itoa(node.NoteID)
anchor := `<a rel="footnote" href="#fn:` + urlFrag + `">` + nStr + `</a>` anchor := `<a href="#fn:` + urlFrag + `">` + nStr + `</a>`
return `<sup class="footnote-ref" id="fnref:` + urlFrag + `">` + anchor + `</sup>` return `<sup class="footnote-ref" id="fnref:` + urlFrag + `">` + anchor + `</sup>`
} }

View File

@ -739,7 +739,7 @@ func TestAutoLink(t *testing.T) {
var footnoteTests = []string{ var footnoteTests = []string{
"testing footnotes.[^a]\n\n[^a]: This is the note\n", "testing footnotes.[^a]\n\n[^a]: This is the note\n",
`<p>testing footnotes.<sup class="footnote-ref" id="fnref:a"><a rel="footnote" href="#fn:a">1</a></sup></p> `<p>testing footnotes.<sup class="footnote-ref" id="fnref:a"><a href="#fn:a">1</a></sup></p>
<div class="footnotes"> <div class="footnotes">
@ -764,7 +764,7 @@ var footnoteTests = []string{
No longer in the footnote No longer in the footnote
`, `,
`<p>testing long<sup class="footnote-ref" id="fnref:b"><a rel="footnote" href="#fn:b">1</a></sup> notes.</p> `<p>testing long<sup class="footnote-ref" id="fnref:b"><a href="#fn:b">1</a></sup> notes.</p>
<p>No longer in the footnote</p> <p>No longer in the footnote</p>
@ -801,7 +801,7 @@ what happens here
[note]: /link/c [note]: /link/c
`, `,
`<p>testing<sup class="footnote-ref" id="fnref:c"><a rel="footnote" href="#fn:c">1</a></sup> multiple<sup class="footnote-ref" id="fnref:d"><a rel="footnote" href="#fn:d">2</a></sup> notes.</p> `<p>testing<sup class="footnote-ref" id="fnref:c"><a href="#fn:c">1</a></sup> multiple<sup class="footnote-ref" id="fnref:d"><a href="#fn:d">2</a></sup> notes.</p>
<p>omg</p> <p>omg</p>
@ -821,7 +821,7 @@ what happens here
`, `,
"testing inline^[this is the note] notes.\n", "testing inline^[this is the note] notes.\n",
`<p>testing inline<sup class="footnote-ref" id="fnref:this-is-the-note"><a rel="footnote" href="#fn:this-is-the-note">1</a></sup> notes.</p> `<p>testing inline<sup class="footnote-ref" id="fnref:this-is-the-note"><a href="#fn:this-is-the-note">1</a></sup> notes.</p>
<div class="footnotes"> <div class="footnotes">
@ -835,7 +835,7 @@ what happens here
`, `,
"testing multiple[^1] types^[inline note] of notes[^2]\n\n[^2]: the second deferred note\n[^1]: the first deferred note\n\n\twhich happens to be a block\n", "testing multiple[^1] types^[inline note] of notes[^2]\n\n[^2]: the second deferred note\n[^1]: the first deferred note\n\n\twhich happens to be a block\n",
`<p>testing multiple<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup> types<sup class="footnote-ref" id="fnref:inline-note"><a rel="footnote" href="#fn:inline-note">2</a></sup> of notes<sup class="footnote-ref" id="fnref:2"><a rel="footnote" href="#fn:2">3</a></sup></p> `<p>testing multiple<sup class="footnote-ref" id="fnref:1"><a href="#fn:1">1</a></sup> types<sup class="footnote-ref" id="fnref:inline-note"><a href="#fn:inline-note">2</a></sup> of notes<sup class="footnote-ref" id="fnref:2"><a href="#fn:2">3</a></sup></p>
<div class="footnotes"> <div class="footnotes">
@ -860,7 +860,7 @@ what happens here
may be multiple paragraphs. may be multiple paragraphs.
`, `,
`<p>This is a footnote<sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup><sup class="footnote-ref" id="fnref:and-this-is-an-i"><a rel="footnote" href="#fn:and-this-is-an-i">2</a></sup></p> `<p>This is a footnote<sup class="footnote-ref" id="fnref:1"><a href="#fn:1">1</a></sup><sup class="footnote-ref" id="fnref:and-this-is-an-i"><a href="#fn:and-this-is-an-i">2</a></sup></p>
<div class="footnotes"> <div class="footnotes">
@ -878,13 +878,13 @@ what happens here
`, `,
"empty footnote[^]\n\n[^]: fn text", "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\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:\">fn text</li>\n</ol>\n\n</div>\n", "<p>empty footnote<sup class=\"footnote-ref\" id=\"fnref:\"><a href=\"#fn:\">1</a></sup></p>\n\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:\">fn text</li>\n</ol>\n\n</div>\n",
"Some text.[^note1]\n\n[^note1]: fn1", "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\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:note1\">fn1</li>\n</ol>\n\n</div>\n", "<p>Some text.<sup class=\"footnote-ref\" id=\"fnref:note1\"><a href=\"#fn:note1\">1</a></sup></p>\n\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:note1\">fn1</li>\n</ol>\n\n</div>\n",
"Some text.[^note1][^note2]\n\n[^note1]: fn1\n[^note2]: fn2\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\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:note1\">fn1</li>\n\n<li id=\"fn:note2\">fn2</li>\n</ol>\n\n</div>\n", "<p>Some text.<sup class=\"footnote-ref\" id=\"fnref:note1\"><a href=\"#fn:note1\">1</a></sup><sup class=\"footnote-ref\" id=\"fnref:note2\"><a href=\"#fn:note2\">2</a></sup></p>\n\n<div class=\"footnotes\">\n\n<hr />\n\n<ol>\n<li id=\"fn:note1\">fn1</li>\n\n<li id=\"fn:note2\">fn2</li>\n</ol>\n\n</div>\n",
`Bla bla [^1] [WWW][w3] `Bla bla [^1] [WWW][w3]
@ -892,7 +892,7 @@ what happens here
[w3]: http://www.w3.org/ [w3]: http://www.w3.org/
`, `,
`<p>Bla bla <sup class="footnote-ref" id="fnref:1"><a rel="footnote" href="#fn:1">1</a></sup> <a href="http://www.w3.org/">WWW</a></p> `<p>Bla bla <sup class="footnote-ref" id="fnref:1"><a href="#fn:1">1</a></sup> <a href="http://www.w3.org/">WWW</a></p>
<div class="footnotes"> <div class="footnotes">
@ -909,7 +909,7 @@ what happens here
[^fn1]: Fine print [^fn1]: Fine print
`, `,
`<p>This is exciting!<sup class="footnote-ref" id="fnref:fn1"><a rel="footnote" href="#fn:fn1">1</a></sup></p> `<p>This is exciting!<sup class="footnote-ref" id="fnref:fn1"><a href="#fn:fn1">1</a></sup></p>
<div class="footnotes"> <div class="footnotes">
@ -973,14 +973,14 @@ func TestNestedFootnotes(t *testing.T) {
[^fn2]: [^fn2]:
Obelisk`, Obelisk`,
`<p>Paragraph.<sup class="footnote-ref" id="fnref:fn1"><a rel="footnote" href="#fn:fn1">1</a></sup></p> `<p>Paragraph.<sup class="footnote-ref" id="fnref:fn1"><a href="#fn:fn1">1</a></sup></p>
<div class="footnotes"> <div class="footnotes">
<hr /> <hr />
<ol> <ol>
<li id="fn:fn1">Asterisk<sup class="footnote-ref" id="fnref:fn2"><a rel="footnote" href="#fn:fn2">2</a></sup></li> <li id="fn:fn1">Asterisk<sup class="footnote-ref" id="fnref:fn2"><a href="#fn:fn2">2</a></sup></li>
<li id="fn:fn2">Obelisk</li> <li id="fn:fn2">Obelisk</li>
</ol> </ol>