git.iko.soy/typeable/pandoc
on master help sign in
HTML writer: Handle csl flipflopping spans (csl-no-emph, etc.)
commitc1ff65e5ef0b5b8d78149cf666cda1de4a0e4fdb authorJohn MacFarlane <jgm@berkeley.edu> dateSat 23 Nov 2013, 14:24 (13 years ago) parent56277ba
1 file changed+16−2
src/Text/Pandoc/Writers/HTML.hs+16−2
src/Text/Pandoc/Writers/HTML.hs+16−2
@@ -613,8 +613,22 @@ inlineToHtml opts inline =
613613 (Str str) -> return $ strToHtml str
614614 (Space) -> return $ strToHtml " "
615615 (LineBreak) -> return $ if writerHtml5 opts then H5.br else H.br
616− (Span attr ils) -> inlineListToHtml opts ils >>=
617− return . addAttrs opts attr . H.span
616+ (Span (id',classes,kvs) ils)
617+ -> inlineListToHtml opts ils >>=
618+ return . addAttrs opts attr' . H.span
619+ where attr' = (id',classes',kvs')
620+ classes' = filter (`notElem` ["csl-no-emph",
621+ "csl-no-strong",
622+ "csl-no-smallcaps"]) classes
623+ kvs' = if null styles
624+ then kvs
625+ else (("style", concat styles) : kvs)
626+ styles = ["font-style:normal;"
627+ | "csl-no-emph" `elem` classes]
628+ ++ ["font-weight:normal;"
629+ | "csl-no-strong" `elem` classes]
630+ ++ ["font-variant:normal;"
631+ | "csl-no-smallcaps" `elem` classes]
618632 (Emph lst) -> inlineListToHtml opts lst >>= return . H.em
619633 (Strong lst) -> inlineListToHtml opts lst >>= return . H.strong
620634 (Code attr str) -> case hlCode of