git.iko.soy/typeable/pandoc
on master help sign in
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

commitf9799c2a425787fb8d5528d00e20e47a56996853 authorJohn MacFarlane <fiddlosopher@gmail.com> dateSat 5 Jan 2013, 17:18 (14 years ago) parent0cc9504
1 file changed+14−6
src/Text/Pandoc/Writers/HTML.hs+14−6
src/Text/Pandoc/Writers/HTML.hs+14−6
@@ -713,11 +713,15 @@ inlineToHtml opts inline =
713713 htmlContents <- blockListToNote opts ref contents
714714 -- push contents onto front of notes
715715 put $ st {stNotes = (htmlContents:notes)}
716− return $ H.sup $
717− H.a ! A.href (toValue $ "#" ++ writerIdentifierPrefix opts ++ "fn" ++ ref)
718− ! A.class_ "footnoteRef"
719− ! prefixedId opts ("fnref" ++ ref)
720− $ toHtml ref
716+ let link = H.a ! A.href (toValue $ "#" ++
717+ writerIdentifierPrefix opts ++ "fn" ++ ref)
718+ ! A.class_ "footnoteRef"
719+ ! prefixedId opts ("fnref" ++ ref)
720+ $ toHtml ref
721+ let link' = case writerEpubVersion opts of
722+ Just EPUB3 -> link ! customAttribute "epub:type" "noteref"
723+ _ -> link
724+ return $ H.sup $ link'
721725 (Cite _ il) -> do contents <- inlineListToHtml opts il
722726 return $ H.span ! A.class_ "citation" $ contents
723727
@@ -738,4 +742,8 @@ blockListToNote opts ref blocks =
738742 _ -> otherBlocks ++ [lastBlock,
739743 Plain backlink]
740744 in do contents <- blockListToHtml opts blocks'
741− return $ nl opts >> (H.li ! (prefixedId opts ("fn" ++ ref)) $ contents)
745+ let noteItem = H.li ! (prefixedId opts ("fn" ++ ref)) $ contents
746+ let noteItem' = case writerEpubVersion opts of
747+ Just EPUB3 -> noteItem ! customAttribute "epub:type" "footnote"
748+ _ -> noteItem
749+ return $ nl opts >> noteItem'