git.iko.soy/typeable/pandoc
on master help sign in
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.

commitd2704c2af19ef1950a2c80909b1a513769acbe1b authorDavid Lazar <lazar6@illinois.edu> dateFri 29 Mar 2013, 10:35 (14 years ago) parent7424454
1 file changed+4−4
src/Text/Pandoc/Readers/Haddock/Parse.y+4−4
src/Text/Pandoc/Readers/Haddock/Parse.y+4−4
@@ -76,7 +76,7 @@ defpara :: { (Inlines, [Blocks]) }
7676
7777para :: { Blocks }
7878 : seq { para' $1 }
79− | codepara { codeBlock $1 }
79+ | codepara { codeBlockWith ([], ["haskell"], []) $1 }
8080 | property { $1 }
8181 | examples { $1 }
8282
@@ -118,8 +118,8 @@ elem1 :: { Inlines }
118118 | URL { makeHyperlink $1 }
119119 | PIC { image $1 $1 mempty }
120120 | ANAME { mempty } -- TODO
121− | IDENT { code $1 }
122− | DQUO strings DQUO { code $2 }
121+ | IDENT { codeWith ([], ["haskell"], []) $1 }
122+ | DQUO strings DQUO { codeWith ([], ["haskell"], []) $2 }
123123
124124strings :: { String }
125125 : STRING { $1 }
@@ -162,7 +162,7 @@ makeProperty s = case strip s of
162162-- | Create an 'Example', stripping superfluous characters as appropriate
163163makeExample :: String -> String -> [String] -> Blocks
164164makeExample prompt expression result =
165− para $ codeWith ([], ["expr"], []) (strip expression ++ "\n")
165+ para $ codeWith ([], ["haskell", "expr"], []) (strip expression ++ "\n")
166166 <> codeWith ([], ["result"], []) (unlines result')
167167 where
168168 -- 1. drop trailing whitespace from the prompt, remember the prefix