@@ -46,7 +46,7 @@ import Data.Sequence (viewr, ViewR(..))
46 PARA { (TokPara,_) }
46 PARA { (TokPara,_) }
47 STRING { (TokString $$,_) }
47 STRING { (TokString $$,_) }
49−%monad { Maybe }
49+%monad { Either [LToken] }
51%name parseParas doc
51%name parseParas doc
52%name parseString seq
52%name parseString seq
@@ -76,7 +76,7 @@ defpara :: { (Inlines, [Blocks]) }
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 }
@@ -118,16 +118,16 @@ 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 }
124strings :: { String }
124strings :: { String }
125 : STRING { $1 }
125 : STRING { $1 }
126 | STRING strings { $1 ++ $2 }
126 | STRING strings { $1 ++ $2 }
129−happyError :: [LToken] -> Maybe a
129+happyError :: [LToken] -> Either [LToken] a
130−happyError toks = Nothing
130+happyError toks = Left toks
132para' :: Inlines -> Blocks
132para' :: Inlines -> Blocks
133para' (Many ils) =
133para' (Many ils) =
@@ -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')
168 -- 1. drop trailing whitespace from the prompt, remember the prefix
168 -- 1. drop trailing whitespace from the prompt, remember the prefix