git.iko.soy/typeable/pandoc
on master help sign in
Add data-cites field to citations in HTML5.

This contains a space-separated list of citation IDs.

commit4ed82686e4016da2de791adf17e6aa6fddebaca5 authorJohn MacFarlane <jgm@berkeley.edu> dateFri 18 Jan 2013, 12:16 (14 years ago) parent809d74b
1 file changed+6−2
src/Text/Pandoc/Writers/HTML.hs+6−2
src/Text/Pandoc/Writers/HTML.hs+6−2
@@ -731,8 +731,12 @@ inlineToHtml opts inline =
731731 Just EPUB3 -> link ! customAttribute "epub:type" "noteref"
732732 _ -> link
733733 return $ H.sup $ link'
734− (Cite _ il) -> do contents <- inlineListToHtml opts il
735− return $ H.span ! A.class_ "citation" $ contents
734+ (Cite cits il)-> do contents <- inlineListToHtml opts il
735+ let citationIds = unwords $ map citationId cits
736+ let result = H.span ! A.class_ "citation" $ contents
737+ return $ if writerHtml5 opts
738+ then result ! customAttribute "data-cites" (toValue citationIds)
739+ else result
736740
737741blockListToNote :: WriterOptions -> String -> [Block] -> State WriterState Html
738742blockListToNote opts ref blocks =