Don't use sup element for epub footnotes.

Instead, just use an a element with class `footnoteRef`.
This allows more styling options, and provides better results
in some readers (e.g. iBooks, where anything inside the a
tag breaks popup footnotes).

Closes #1995.
This commit is contained in:
John MacFarlane 2015-05-11 21:58:01 -07:00
parent a131441da4
commit 4560447041
2 changed files with 5 additions and 2 deletions

View file

@ -12,3 +12,4 @@ h2.author { }
h3.date { }
ol.toc { padding: 0; margin-left: 1em; }
ol.toc li { list-style-type: none; margin: 0; padding: 0; }
a.footnoteRef { vertical-align: super; }

View file

@ -46,7 +46,7 @@ import Numeric ( showHex )
import Data.Char ( ord, toLower )
import Data.List ( isPrefixOf, intersperse )
import Data.String ( fromString )
import Data.Maybe ( catMaybes, fromMaybe )
import Data.Maybe ( catMaybes, fromMaybe, isJust )
import Control.Monad.State
import Text.Blaze.Html hiding(contents)
#if MIN_VERSION_blaze_markup(0,6,3)
@ -825,7 +825,9 @@ inlineToHtml opts inline =
writerIdentifierPrefix opts ++ "fn" ++ ref)
! A.class_ "footnoteRef"
! prefixedId opts ("fnref" ++ ref)
$ H.sup
$ (if isJust (writerEpubVersion opts)
then id
else H.sup)
$ toHtml ref
return $ case writerEpubVersion opts of
Just EPUB3 -> link ! customAttribute "epub:type" "noteref"