git.iko.soy/typeable/pandoc
on master help sign in
FB2 writer: do not wrap note references into <sup> and brackets

Existing FB2 readers, such as FBReader, already display links with type="note" as a superscript.

commit2e13c0a451fe87ebd1ef2c314f7f98c40f3ec422 authorAlexander Krotov <ilabdsf@gmail.com> dateFri 10 May 2019, 09:17 (7 years ago) parentf1fbec9
3 files changed+6−18
src/Text/Pandoc/Writers/FB2.hs+1−1 test/fb2/basic.fb2+1−3 test/writer.fb2+4−14
src/Text/Pandoc/Writers/FB2.hs+1−1
@@ -439,7 +439,7 @@ toXml (Note bs) = do
439439 let fn_id = footnoteID n
440440 fn_desc <- cMapM blockToXml bs
441441 modify (\s -> s { footnotes = (n, fn_id, fn_desc) : fns })
442− let fn_ref = el "sup" . txt $ "[" ++ show n ++ "]"
442+ let fn_ref = txt $ "[" ++ show n ++ "]"
443443 return . list $ el "a" ( [ attr ("l","href") ('#':fn_id)
444444 , uattr "type" "note" ]
445445 , fn_ref )
test/fb2/basic.fb2+1−3
@@ -55,9 +55,7 @@ citatons.</p>
5555<empty-line />
5656<p>
5757<strikethrough>Strikeout</strikethrough> is Pandoc’s extension.
58−Superscript and subscripts too: H<sub>2</sub>O is a liquid<a l:href="#n1" type="note">
59−<sup>[1]</sup>
60−</a>.
58+Superscript and subscripts too: H<sub>2</sub>O is a liquid<a l:href="#n1" type="note">[1]</a>.
61592<sup>10</sup> is 1024.</p>
6260<p>Math is another Pandoc extension: <code>E = m c^2</code>.</p>
6361</section>
test/writer.fb2+4−14
@@ -696,25 +696,15 @@ So is ‘pine.’</p>
696696<title>
697697<p>Footnotes</p>
698698</title>
699−<p>Here is a footnote reference,<a l:href="#n1" type="note">
700−<sup>[1]</sup>
701−</a> and another.<a l:href="#n2" type="note">
702−<sup>[2]</sup>
703−</a>
699+<p>Here is a footnote reference,<a l:href="#n1" type="note">[1]</a> and another.<a l:href="#n2" type="note">[2]</a>
704700This should <emphasis>not</emphasis> be a footnote reference, because it
705−contains a space.[^my note] Here is an inline note.<a l:href="#n3" type="note">
706−<sup>[3]</sup>
707−</a>
701+contains a space.[^my note] Here is an inline note.<a l:href="#n3" type="note">[3]</a>
708702</p>
709703<cite>
710−<p>Notes can go in quotes.<a l:href="#n4" type="note">
711−<sup>[4]</sup>
712−</a>
704+<p>Notes can go in quotes.<a l:href="#n4" type="note">[4]</a>
713705</p>
714706</cite>
715−<p>1. And in list items.<a l:href="#n5" type="note">
716−<sup>[5]</sup>
717−</a>
707+<p>1. And in list items.<a l:href="#n5" type="note">[5]</a>
718708</p>
719709<p>This paragraph should not be part of the note, as it is not indented.</p>
720710</section>