diff options
author | John MacFarlane <jgm@berkeley.edu> | 2013-11-23 14:24:33 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2013-11-23 14:24:33 -0800 |
commit | c1ff65e5ef0b5b8d78149cf666cda1de4a0e4fdb (patch) | |
tree | e01ddd749685092016d82b7834ed45b20afd57b8 | |
parent | 56277bacea73818a7541b60987e5bc877782baab (diff) | |
download | pandoc-c1ff65e5ef0b5b8d78149cf666cda1de4a0e4fdb.tar.gz |
HTML writer: Handle csl flipflopping spans (csl-no-emph, etc.)
-rw-r--r-- | src/Text/Pandoc/Writers/HTML.hs | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs index 424843539..641652276 100644 --- a/src/Text/Pandoc/Writers/HTML.hs +++ b/src/Text/Pandoc/Writers/HTML.hs @@ -613,8 +613,22 @@ inlineToHtml opts inline = (Str str) -> return $ strToHtml str (Space) -> return $ strToHtml " " (LineBreak) -> return $ if writerHtml5 opts then H5.br else H.br - (Span attr ils) -> inlineListToHtml opts ils >>= - return . addAttrs opts attr . H.span + (Span (id',classes,kvs) ils) + -> inlineListToHtml opts ils >>= + return . addAttrs opts attr' . H.span + where attr' = (id',classes',kvs') + classes' = filter (`notElem` ["csl-no-emph", + "csl-no-strong", + "csl-no-smallcaps"]) classes + kvs' = if null styles + then kvs + else (("style", concat styles) : kvs) + styles = ["font-style:normal;" + | "csl-no-emph" `elem` classes] + ++ ["font-weight:normal;" + | "csl-no-strong" `elem` classes] + ++ ["font-variant:normal;" + | "csl-no-smallcaps" `elem` classes] (Emph lst) -> inlineListToHtml opts lst >>= return . H.em (Strong lst) -> inlineListToHtml opts lst >>= return . H.strong (Code attr str) -> case hlCode of |