aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlexander Kondratskiy <kholdstare0.0@gmail.com>2013-07-13 02:23:27 -0400
committerAlexander Kondratskiy <kholdstare0.0@gmail.com>2013-07-13 02:23:27 -0400
commit6a235ba60693596af3f13b093b83defa37501e09 (patch)
treedca76d73be1af9d54c801a93b9e4c3a71261ddf0 /src
parentbd1079e48e055f7b58ce13be3dfa8b5c5cb5ba7c (diff)
downloadpandoc-6a235ba60693596af3f13b093b83defa37501e09.tar.gz
Checking options before applying syntax highlighting for HTML output
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/HTML.hs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/HTML.hs b/src/Text/Pandoc/Writers/HTML.hs
index 57bf2a349..cfc187e02 100644
--- a/src/Text/Pandoc/Writers/HTML.hs
+++ b/src/Text/Pandoc/Writers/HTML.hs
@@ -422,7 +422,10 @@ blockToHtml opts (CodeBlock (id',classes,keyvals) rawCode) = do
adjCode = if tolhs
then unlines . map ("> " ++) . lines $ rawCode
else rawCode
- case highlight formatHtmlBlock (id',classes',keyvals) adjCode of
+ hlCode = if writerHighlight opts -- check highlighting options
+ then highlight formatHtmlBlock (id',classes',keyvals) adjCode
+ else Nothing
+ case hlCode of
Nothing -> return $ addAttrs opts (id',classes,keyvals)
$ H.pre $ H.code $ toHtml adjCode
Just h -> modify (\st -> st{ stHighlighting = True }) >>
@@ -589,14 +592,17 @@ inlineToHtml opts inline =
(LineBreak) -> return $ if writerHtml5 opts then H5.br else H.br
(Emph lst) -> inlineListToHtml opts lst >>= return . H.em
(Strong lst) -> inlineListToHtml opts lst >>= return . H.strong
- (Code attr str) -> case highlight formatHtmlInline attr str of
+ (Code attr str) -> case hlCode of
Nothing -> return
$ addAttrs opts attr
$ H.code $ strToHtml str
Just h -> do
modify $ \st -> st{ stHighlighting = True }
return $ addAttrs opts (id',[],keyvals) h
- where (id',_,keyvals) = attr
+ where (id',_,keyvals) = attr
+ hlCode = if writerHighlight opts
+ then highlight formatHtmlInline attr str
+ else Nothing
(Strikeout lst) -> inlineListToHtml opts lst >>=
return . H.del
(SmallCaps lst) -> inlineListToHtml opts lst >>=