Fixed handling of default extensions, so they don't override +options.
This commit is contained in:
parent
0cb7362f62
commit
05216d2919
1 changed files with 10 additions and 8 deletions
|
@ -176,8 +176,7 @@ parseFormatSpec = parse formatSpec ""
|
|||
readers :: [(String, ReaderOptions -> String -> Pandoc)]
|
||||
readers = [("native" , \_ -> readNative)
|
||||
,("json" , \_ -> decodeJSON)
|
||||
,("strict" , \o -> readMarkdown
|
||||
o{ readerExtensions = strictExtensions } )
|
||||
,("strict" , readMarkdown)
|
||||
,("markdown" , readMarkdown)
|
||||
,("rst" , readRST)
|
||||
,("docbook" , readDocBook)
|
||||
|
@ -221,8 +220,7 @@ writers = [
|
|||
,("texinfo" , PureStringWriter writeTexinfo)
|
||||
,("man" , PureStringWriter writeMan)
|
||||
,("markdown" , PureStringWriter writeMarkdown)
|
||||
,("strict" , PureStringWriter $ \o ->
|
||||
writeMarkdown o{ writerExtensions = strictExtensions } )
|
||||
,("strict" , PureStringWriter writeMarkdown)
|
||||
,("plain" , PureStringWriter writePlain)
|
||||
,("rst" , PureStringWriter writeRST)
|
||||
,("mediawiki" , PureStringWriter writeMediaWiki)
|
||||
|
@ -232,6 +230,10 @@ writers = [
|
|||
,("asciidoc" , PureStringWriter writeAsciiDoc)
|
||||
]
|
||||
|
||||
getDefaultExtensions :: String -> Set Extension
|
||||
getDefaultExtensions "strict" = strictExtensions
|
||||
getDefaultExtensions _ = pandocExtensions
|
||||
|
||||
-- | Retrieve reader based on formatSpec (format+extensions).
|
||||
getReader :: String -> Either String (ReaderOptions -> String -> Pandoc)
|
||||
getReader s =
|
||||
|
@ -242,7 +244,7 @@ getReader s =
|
|||
Nothing -> Left $ "Unknown reader: " ++ readerName
|
||||
Just r -> Right $ \o ->
|
||||
r o{ readerExtensions = setExts $
|
||||
readerExtensions o }
|
||||
getDefaultExtensions readerName }
|
||||
|
||||
-- | Retrieve writer based on formatSpec (format+extensions).
|
||||
getWriter :: String -> Either String Writer
|
||||
|
@ -254,13 +256,13 @@ getWriter s =
|
|||
Nothing -> Left $ "Unknown writer: " ++ writerName
|
||||
Just (PureStringWriter r) -> Right $ PureStringWriter $
|
||||
\o -> r o{ writerExtensions = setExts $
|
||||
writerExtensions o }
|
||||
getDefaultExtensions writerName }
|
||||
Just (IOStringWriter r) -> Right $ IOStringWriter $
|
||||
\o -> r o{ writerExtensions = setExts $
|
||||
writerExtensions o }
|
||||
getDefaultExtensions writerName }
|
||||
Just (IOByteStringWriter r) -> Right $ IOByteStringWriter $
|
||||
\o -> r o{ writerExtensions = setExts $
|
||||
writerExtensions o }
|
||||
getDefaultExtensions writerName }
|
||||
|
||||
{-# DEPRECATED jsonFilter "Use toJsonFilter instead" #-}
|
||||
-- | Converts a transformation on the Pandoc AST into a function
|
||||
|
|
Loading…
Reference in a new issue