diff options
author | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-05 17:18:43 -0800 |
---|---|---|
committer | John MacFarlane <fiddlosopher@gmail.com> | 2013-01-05 17:18:43 -0800 |
commit | f9799c2a425787fb8d5528d00e20e47a56996853 (patch) | |
tree | d325cb34587a34ae27c08930ccce5d19868e0356 /src | |
parent | 0cc9504796849e017d90ef05b8183bee94ea1972 (diff) | |
download | pandoc-f9799c2a425787fb8d5528d00e20e47a56996853.tar.gz |
For epub3, use epub:type to mark footnotes and footnote refs.
This yields nice popup footnotes in iBooks. See
http://www.pigsgourdsandwikis.com/2012/05/creating-pop-up-footnotes-in-epub-3-and.html
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 2345243d2..7fe77a69c 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -713,11 +713,15 @@ inlineToHtml opts inline = htmlContents <- blockListToNote opts ref contents -- push contents onto front of notes put $ st {stNotes = (htmlContents:notes)} - return $ H.sup $ - H.a ! A.href (toValue $ "#" ++ writerIdentifierPrefix opts ++ "fn" ++ ref) - ! A.class_ "footnoteRef" - ! prefixedId opts ("fnref" ++ ref) - $ toHtml ref + let link = H.a ! A.href (toValue $ "#" ++ + writerIdentifierPrefix opts ++ "fn" ++ ref) + ! A.class_ "footnoteRef" + ! prefixedId opts ("fnref" ++ ref) + $ toHtml ref + let link' = case writerEpubVersion opts of + Just EPUB3 -> link ! customAttribute "epub:type" "noteref" + _ -> link + return $ H.sup $ link' (Cite _ il) -> do contents <- inlineListToHtml opts il return $ H.span ! A.class_ "citation" $ contents @@ -738,4 +742,8 @@ blockListToNote opts ref blocks = _ -> otherBlocks ++ [lastBlock, Plain backlink] in do contents <- blockListToHtml opts blocks' - return $ nl opts >> (H.li ! (prefixedId opts ("fn" ++ ref)) $ contents) + let noteItem = H.li ! (prefixedId opts ("fn" ++ ref)) $ contents + let noteItem' = case writerEpubVersion opts of + Just EPUB3 -> noteItem ! customAttribute "epub:type" "footnote" + _ -> noteItem + return $ nl opts >> noteItem' |