diff options
author | defanor <defanor@uberspace.net> | 2017-11-23 13:49:07 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2017-11-23 14:41:13 +0300 |
commit | 6f335b9bb792a8d1133676b60518efdd84cf3886 (patch) | |
tree | f5a54ba2d44db37b308c13e9e9f9ebd43d6eb3b3 /Pancake/Reading.hs | |
parent | 07fa7ad1000f6ac6fd76fc9233c150bdbde2e67b (diff) |
Use default pandoc extensions
Identifiers get handled better with those. And since they also add
divs, rendering of lists of blocks is slightly improved to avoid
unnecessary spacing.
Diffstat (limited to 'Pancake/Reading.hs')
-rw-r--r-- | Pancake/Reading.hs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Pancake/Reading.hs b/Pancake/Reading.hs index d54d7b3..686e3cf 100644 --- a/Pancake/Reading.hs +++ b/Pancake/Reading.hs @@ -121,7 +121,7 @@ readDoc :: BS.ByteString -- ^ A parsed document. readDoc out dt uri = do term <- setupTermFromEnv - let reader = either (const plain) id $ + let (reader, exts) = either (const plain) id $ maybe (Left "no type suggestions") (byExtension . ('.':)) dt <|> case (uriScheme uri, map toLower $ takeExtension $ uriPath uri) of -- some exceptions and special cases (might be better to make @@ -141,14 +141,14 @@ readDoc out dt uri = do _ -> byExtension ext <|> gopher (_, ext) -> byExtension ext cols = fromMaybe 80 $ getCapability term termColumns - opts = def { P.readerColumns = cols } + opts = def { P.readerColumns = cols, P.readerExtensions = exts } case reader of - (P.TextReader f, _) -> case decodeUtf8' out of + P.TextReader f -> case decodeUtf8' out of Left err -> do putErrLn $ show err P.runIO $ f opts $ decodeLatin1 out Right r -> P.runIO $ f opts r - (P.ByteStringReader f, _) -> P.runIO $ f opts $ BL.fromStrict out + P.ByteStringReader f -> P.runIO $ f opts $ BL.fromStrict out where http ext = byExtension ext <|> html html = P.getReader "html" |