aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Lazar <lazar6@illinois.edu>2013-03-29 10:35:06 -0700
committerDavid Lazar <lazar6@illinois.edu>2013-03-29 10:35:06 -0700
commitd2704c2af19ef1950a2c80909b1a513769acbe1b (patch)
tree5517c4bad8d91b6f463d709d4e4d7315123148a8 /src
parent7424454acef153176a14c3f95e925d5edd6b2e87 (diff)
downloadpandoc-d2704c2af19ef1950a2c80909b1a513769acbe1b.tar.gz
Haddock reader: add the "haskell" attribute to code blocks so they are
highlighted. We reasonably assume that code blocks in Haddock markup wont be used for anything but Haskell code.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Haddock/Parse.y8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Readers/Haddock/Parse.y b/src/Text/Pandoc/Readers/Haddock/Parse.y
index c45e09113..e34f9d95e 100644
--- a/src/Text/Pandoc/Readers/Haddock/Parse.y
+++ b/src/Text/Pandoc/Readers/Haddock/Parse.y
@@ -76,7 +76,7 @@ defpara :: { (Inlines, [Blocks]) }
para :: { Blocks }
: seq { para' $1 }
- | codepara { codeBlock $1 }
+ | codepara { codeBlockWith ([], ["haskell"], []) $1 }
| property { $1 }
| examples { $1 }
@@ -118,8 +118,8 @@ elem1 :: { Inlines }
| URL { makeHyperlink $1 }
| PIC { image $1 $1 mempty }
| ANAME { mempty } -- TODO
- | IDENT { code $1 }
- | DQUO strings DQUO { code $2 }
+ | IDENT { codeWith ([], ["haskell"], []) $1 }
+ | DQUO strings DQUO { codeWith ([], ["haskell"], []) $2 }
strings :: { String }
: STRING { $1 }
@@ -162,7 +162,7 @@ makeProperty s = case strip s of
-- | Create an 'Example', stripping superfluous characters as appropriate
makeExample :: String -> String -> [String] -> Blocks
makeExample prompt expression result =
- para $ codeWith ([], ["expr"], []) (strip expression ++ "\n")
+ para $ codeWith ([], ["haskell", "expr"], []) (strip expression ++ "\n")
<> codeWith ([], ["result"], []) (unlines result')
where
-- 1. drop trailing whitespace from the prompt, remember the prefix