diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-02-10 18:15:55 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-02-10 18:15:55 -0800 |
commit | 9abb458cbbcf93f6cd0f435c26ce67d77762e3ac (patch) | |
tree | e78772f45e2372cf071ce4f0f79accd29cdbbf07 /src | |
parent | 3c6d52df342a02f4d772383ef91b1ea050eb9593 (diff) | |
download | pandoc-9abb458cbbcf93f6cd0f435c26ce67d77762e3ac.tar.gz |
Implement aria roles doc-bibliography, doc-biblioentry, doc-biblioref.
Note that doc-biblioref is only used when link-citations produces
links, since it belongs on links.
See #4213.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 2ae3d819c..6fb4bbfb1 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -731,7 +731,10 @@ blockToHtml opts (Div attr@(ident, classes, kvs') bs) = do slideVariant <- gets stSlideVariant let kvs = [(k,v) | (k,v) <- kvs', k /= "width"] ++ [("style", "width:" ++ w ++ ";") - | ("width",w) <- kvs', "column" `elem` classes] + | ("width",w) <- kvs', "column" `elem` classes] ++ + [("role", "doc-bibliography") | ident == "refs" && html5] ++ + [("role", "doc-biblioentry") + | "ref-item" `isPrefixOf` ident && html5] let speakerNotes = "notes" `elem` classes -- we don't want incremental output inside speaker notes, see #1394 let opts' = if | speakerNotes -> opts{ writerIncremental = False } @@ -1188,13 +1191,18 @@ inlineToHtml opts inline = do _ | html5 -> link ! H5.customAttribute "role" "doc-noteref" _ -> link - (Cite cits il)-> do contents <- inlineListToHtml opts il + (Cite cits il)-> do contents <- inlineListToHtml opts (walk addRoleToLink il) let citationIds = unwords $ map citationId cits let result = H.span ! A.class_ "citation" $ contents return $ if html5 then result ! customAttribute "data-cites" (toValue citationIds) else result +addRoleToLink :: Inline -> Inline +addRoleToLink (Link (id',classes,kvs) ils (src,tit)) = + Link (id',classes,("role","doc-biblioref"):kvs) ils (src,tit) +addRoleToLink x = x + blockListToNote :: PandocMonad m => WriterOptions -> String -> [Block] -> StateT WriterState m Html |