diff options
| author | John MacFarlane <jgm@berkeley.edu> | 2013-03-30 09:16:10 -0700 |
|---|---|---|
| committer | John MacFarlane <jgm@berkeley.edu> | 2013-03-30 09:16:10 -0700 |
| commit | 5aec167e71b3da98a0f209e3c75af019682ad354 (patch) | |
| tree | 9b40e96cb359b1f223880cb650e83edb4d506c60 /src/Text/Pandoc/Readers/Haddock/Parse.y | |
| parent | 7cb8b60910ede36bba3598f85a06ddde6fc545d0 (diff) | |
| parent | 86636677881ab7eace0fd9b2993cfdb01adb7b18 (diff) | |
| download | pandoc-5aec167e71b3da98a0f209e3c75af019682ad354.tar.gz | |
Merge pull request #808 from davidlazar/master
Improvements to Haddock reader
Diffstat (limited to 'src/Text/Pandoc/Readers/Haddock/Parse.y')
| -rw-r--r-- | src/Text/Pandoc/Readers/Haddock/Parse.y | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/Text/Pandoc/Readers/Haddock/Parse.y b/src/Text/Pandoc/Readers/Haddock/Parse.y index 26d7c287d..e34f9d95e 100644 --- a/src/Text/Pandoc/Readers/Haddock/Parse.y +++ b/src/Text/Pandoc/Readers/Haddock/Parse.y @@ -46,7 +46,7 @@ import Data.Sequence (viewr, ViewR(..)) PARA { (TokPara,_) } STRING { (TokString $$,_) } -%monad { Maybe } +%monad { Either [LToken] } %name parseParas doc %name parseString seq @@ -76,7 +76,7 @@ defpara :: { (Inlines, [Blocks]) } para :: { Blocks } : seq { para' $1 } - | codepara { codeBlock $1 } + | codepara { codeBlockWith ([], ["haskell"], []) $1 } | property { $1 } | examples { $1 } @@ -118,16 +118,16 @@ 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 } | STRING strings { $1 ++ $2 } { -happyError :: [LToken] -> Maybe a -happyError toks = Nothing +happyError :: [LToken] -> Either [LToken] a +happyError toks = Left toks para' :: Inlines -> Blocks para' (Many ils) = @@ -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 |
