git.iko.soy/typeable/pandoc
on master help sign in
Haddock reader: add the "haskell" attribute to code blocks so they are
d2704c2David Lazar
src/Text/Pandoc/Readers/Haddock/Parse.y+4−4
@@ -76,7 +76,7 @@ defpara :: { (Inlines, [Blocks]) }
76
76
77para :: { Blocks }
77para :: { Blocks }
78 : seq { para' $1 }
78 : seq { para' $1 }
79− | codepara { codeBlock $1 }
79+ | codepara { codeBlockWith ([], ["haskell"], []) $1 }
80 | property { $1 }
80 | property { $1 }
81 | examples { $1 }
81 | examples { $1 }
82
82
@@ -118,8 +118,8 @@ elem1 :: { Inlines }
118 | URL { makeHyperlink $1 }
118 | URL { makeHyperlink $1 }
119 | PIC { image $1 $1 mempty }
119 | PIC { image $1 $1 mempty }
120 | ANAME { mempty } -- TODO
120 | ANAME { mempty } -- TODO
121− | IDENT { code $1 }
121+ | IDENT { codeWith ([], ["haskell"], []) $1 }
122− | DQUO strings DQUO { code $2 }
122+ | DQUO strings DQUO { codeWith ([], ["haskell"], []) $2 }
123
123
124strings :: { String }
124strings :: { String }
125 : STRING { $1 }
125 : STRING { $1 }
@@ -162,7 +162,7 @@ makeProperty s = case strip s of
162-- | Create an 'Example', stripping superfluous characters as appropriate
162-- | Create an 'Example', stripping superfluous characters as appropriate
163makeExample :: String -> String -> [String] -> Blocks
163makeExample :: String -> String -> [String] -> Blocks
164makeExample prompt expression result =
164makeExample prompt expression result =
165− para $ codeWith ([], ["expr"], []) (strip expression ++ "\n")
165+ para $ codeWith ([], ["haskell", "expr"], []) (strip expression ++ "\n")
166 <> codeWith ([], ["result"], []) (unlines result')
166 <> codeWith ([], ["result"], []) (unlines result')
167 where
167 where
168 -- 1. drop trailing whitespace from the prompt, remember the prefix
168 -- 1. drop trailing whitespace from the prompt, remember the prefix