aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2013-01-18 12:16:12 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2013-01-18 12:16:12 -0800
commit4ed82686e4016da2de791adf17e6aa6fddebaca5 (patch)
tree8979ffb933adb5103ecafae70c7ffcb7f55f429c
parent809d74b86db2f261248141ec8820951e5854a7f7 (diff)
downloadpandoc-4ed82686e4016da2de791adf17e6aa6fddebaca5.tar.gz
Add data-cites field to citations in HTML5.
This contains a space-separated list of citation IDs.
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 3111cbecb..32d52f3e7 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -731,8 +731,12 @@ inlineToHtml opts inline =
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
+ (Cite cits il)-> do contents <- inlineListToHtml opts il
+ let citationIds = unwords $ map citationId cits
+ let result = H.span ! A.class_ "citation" $ contents
+ return $ if writerHtml5 opts
+ then result ! customAttribute "data-cites" (toValue citationIds)
+ else result
blockListToNote :: WriterOptions -> String -> [Block] -> State WriterState Html
blockListToNote opts ref blocks =