aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Writers/HTML.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-01-22 11:36:30 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2017-01-25 17:07:43 +0100
commitd1efc839f129d23fe8a6523e33a01b0b463ee409 (patch)
tree73149a80a0dbd001689ee91d00692ea792209512 /src/Text/Pandoc/Writers/HTML.hs
parent6f9df9b4f1d3d22c53b9d6f3c333efc23a84ffe7 (diff)
downloadpandoc-d1efc839f129d23fe8a6523e33a01b0b463ee409.tar.gz
Removed writerHighlight; made writerHighlightStyle a Maybe.
API change. For no highlighting, set writerHighlightStyle to Nothing.
Diffstat (limited to 'src/Text/Pandoc/Writers/HTML.hs')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index e144d0d63..c6d7b7f6a 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -179,8 +179,10 @@ pandocToHtml opts (Pandoc meta blocks) = do
| otherwise -> mempty
Nothing -> mempty
let context = (if stHighlighting st
- then defField "highlighting-css"
- (styleToCss $ writerHighlightStyle opts)
+ then case writerHighlightStyle opts of
+ Just sty -> defField "highlighting-css"
+ (styleToCss sty)
+ Nothing -> id
else id) $
(if stMath st
then defField "math" (renderHtml math)
@@ -509,8 +511,9 @@ blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do
adjCode = if tolhs
then unlines . map ("> " ++) . lines $ rawCode
else rawCode
- hlCode = if writerHighlight opts -- check highlighting options
- then highlight formatHtmlBlock (id',classes',keyvals) adjCode
+ hlCode = if isJust (writerHighlightStyle opts)
+ then highlight formatHtmlBlock
+ (id',classes',keyvals) adjCode
else Nothing
case hlCode of
Nothing -> return $ addAttrs opts (id',classes,keyvals)
@@ -702,7 +705,8 @@ annotateMML e tex = math (unode "semantics" [cs, unode "annotation" (annotAttrs,
-- | Convert Pandoc inline element to HTML.
-inlineToHtml :: PandocMonad m => WriterOptions -> Inline -> StateT WriterState m Html
+inlineToHtml :: PandocMonad m
+ => WriterOptions -> Inline -> StateT WriterState m Html
inlineToHtml opts inline =
case inline of
(Str str) -> return $ strToHtml str
@@ -739,8 +743,9 @@ inlineToHtml opts inline =
modify $ \st -> st{ stHighlighting = True }
return $ addAttrs opts (id',[],keyvals) h
where (id',_,keyvals) = attr
- hlCode = if writerHighlight opts
- then highlight formatHtmlInline attr str
+ hlCode = if isJust (writerHighlightStyle opts)
+ then highlight formatHtmlInline
+ attr str
else Nothing
(Strikeout lst) -> inlineListToHtml opts lst >>=
return . H.del