Skip to content
Permalink
Browse files

Footnote link spacing

Fix tests
  • Loading branch information
martynchamberlin authored and gettalong committed Dec 15, 2016
1 parent 4c5f97a commit f4cdae257159ce0addf542739fed262e4a2cf401
@@ -453,9 +453,9 @@ def footnote_content
end

unless @options[:footnote_backlink].empty?
para.children << Element.new(:raw, FOOTNOTE_BACKLINK_FMT % [insert_space ? ' ' : '', name, backlink_text])
para.children << Element.new(:raw, FOOTNOTE_BACKLINK_FMT % [insert_space ? '&nbsp;' : '', name, backlink_text])
(1..repeat).each do |index|
para.children << Element.new(:raw, FOOTNOTE_BACKLINK_FMT % [" ", "#{name}:#{index}", "#{backlink_text}<sup>#{index+1}</sup>"])
para.children << Element.new(:raw, FOOTNOTE_BACKLINK_FMT % ["&nbsp;", "#{name}:#{index}", "#{backlink_text}<sup>#{index+1}</sup>"])
end
end

@@ -15,7 +15,7 @@ <h1>without header id</h1>
<div class="footnotes">
<ol start="10">
<li id="fn:ab">
<p>Some text. <a href="#fnref:ab" class="reversefootnote">&#8617;</a></p>
<p>Some text.&nbsp;<a href="#fnref:ab" class="reversefootnote">&#8617;</a></p>
</li>
</ol>
</div>
@@ -4,7 +4,7 @@
<div class="footnotes">
<ol>
<li id="fn:ab">
<p>Some text. <a href="#fnref:ab" class="reversefootnote">&#8617;</a></p>
<p>Some text.&nbsp;<a href="#fnref:ab" class="reversefootnote">&#8617;</a></p>
</li>
</ol>
</div>
@@ -7,7 +7,7 @@ <h1 id="header1-level-1">Header<sup id="fnref:1"><a href="#fn:1" class="footnote
<div class="footnotes">
<ol>
<li id="fn:1">
<p>Some footnote content here <a href="#fnref:1" class="reversefootnote">&#8617;</a></p>
<p>Some footnote content here&nbsp;<a href="#fnref:1" class="reversefootnote">&#8617;</a></p>
</li>
</ol>
</div>
@@ -3,7 +3,7 @@
<div class="footnotes">
<ol>
<li id="fn:fn">
<p>Some text here <a href="#fnref:fn" class="reversefootnote">text &8617; &lt;img /&gt;</a></p>
<p>Some text here&nbsp;<a href="#fnref:fn" class="reversefootnote">text &8617; &lt;img /&gt;</a></p>
</li>
</ol>
</div>
@@ -3,10 +3,10 @@
<div class="footnotes">
<ol start="35">
<li id="fn:ab">
<p>Some text. <a href="#fnref:ab" class="reversefootnote">&#8617;</a></p>
<p>Some text.&nbsp;<a href="#fnref:ab" class="reversefootnote">&#8617;</a></p>
</li>
<li id="fn:bc">
<p>Some other text. <a href="#fnref:bc" class="reversefootnote">&#8617;</a></p>
<p>Some other text.&nbsp;<a href="#fnref:bc" class="reversefootnote">&#8617;</a></p>
</li>
</ol>
</div>
@@ -5,13 +5,13 @@
<div class="footnotes">
<ol>
<li id="fn:first">
<p>Consecutur adisping.<sup id="fnref:third"><a href="#fn:third" class="footnote">3</a></sup> <a href="#fnref:first" class="reversefootnote">&#8617;</a></p>
<p>Consecutur adisping.<sup id="fnref:third"><a href="#fn:third" class="footnote">3</a></sup>&nbsp;<a href="#fnref:first" class="reversefootnote">&#8617;</a></p>
</li>
<li id="fn:second">
<p>Sed ut perspiciatis unde omnis. <a href="#fnref:second" class="reversefootnote">&#8617;</a></p>
<p>Sed ut perspiciatis unde omnis.&nbsp;<a href="#fnref:second" class="reversefootnote">&#8617;</a></p>
</li>
<li id="fn:third">
<p>Sed ut. <a href="#fnref:third" class="reversefootnote">&#8617;</a></p>
<p>Sed ut.&nbsp;<a href="#fnref:third" class="reversefootnote">&#8617;</a></p>
</li>
</ol>
</div>
@@ -17,7 +17,7 @@ <h1>And a header<sup id="fnref:now"><a href="#fn:now" class="footnote">4</a></su
<div class="footnotes">
<ol>
<li id="fn:fn">
<p>Some foot note text <a href="#fnref:fn" class="reversefootnote">&#8617;</a> <a href="#fnref:fn:1" class="reversefootnote">&#8617;<sup>2</sup></a> <a href="#fnref:fn:2" class="reversefootnote">&#8617;<sup>3</sup></a></p>
<p>Some foot note text&nbsp;<a href="#fnref:fn" class="reversefootnote">&#8617;</a>&nbsp;<a href="#fnref:fn:1" class="reversefootnote">&#8617;<sup>2</sup></a>&nbsp;<a href="#fnref:fn:2" class="reversefootnote">&#8617;<sup>3</sup></a></p>
</li>
<li id="fn:3">
<p>other text
@@ -29,7 +29,7 @@ <h1>And a header<sup id="fnref:now"><a href="#fn:now" class="footnote">4</a></su
<p><a href="#fnref:3" class="reversefootnote">&#8617;</a></p>
</li>
<li id="fn:1">
<p>some <em>text</em> <a href="#fnref:1" class="reversefootnote">&#8617;</a></p>
<p>some <em>text</em>&nbsp;<a href="#fnref:1" class="reversefootnote">&#8617;</a></p>
</li>
<li id="fn:now">

@@ -1,7 +1,7 @@
<div class="footnotes">
<ol>
<li id="fn:1">
<p>Footnote \` text <a href="#fnref:1" class="reversefootnote">&#8617;</a></p>
<p>Footnote \` text&nbsp;<a href="#fnref:1" class="reversefootnote">&#8617;</a></p>
</li>
</ol>
</div>
@@ -8,7 +8,7 @@ <h1>Test</h1>
<ol>
<li id="fn:note1">

<p>A note <a href="#fnref:note1" class="reversefootnote">&#8617;</a></p>
<p>A note&nbsp;<a href="#fnref:note1" class="reversefootnote">&#8617;</a></p>
</li>
</ol>
</div>

3 comments on commit f4cdae2

@kandsten

This comment has been minimized.

Copy link

kandsten replied Aug 13, 2017

This is problematic if you at some point want to deal with the output as XML, since HTML5 doesn't get the DTD reference to declare the &nbsp entity as valid. Sort of a niche case, but figured it to be worth a mention since it broke one of my validators.

@gettalong

This comment has been minimized.

Copy link
Owner

gettalong replied Sep 8, 2017

@kandsten So I guess this would work if we use a numeric entity?

@gettalong

This comment has been minimized.

Copy link
Owner

gettalong replied Sep 8, 2017

The value of the entity_output option is used to determine how to output the entity in the next release. This should avoid the problem.

Please sign in to comment.
You can’t perform that action at this time.