@@ -43,8 +43,7 @@ inline links:
44> markdownToRST :: String -> String
44> markdownToRST :: String -> String
45> markdownToRST =
45> markdownToRST =
46−> (writeRST defaultWriterOptions {writerReferenceLinks = True}) .
46+> (writeRST def {writerReferenceLinks = True}) . readMarkdown def
47−> readMarkdown defaultParserState
49> main = getContents >>= putStrLn . markdownToRST
48> main = getContents >>= putStrLn . markdownToRST
@@ -73,14 +72,6 @@ module Text.Pandoc
73 , readTextile
72 , readTextile
74 , readDocBook
73 , readDocBook
75 , readNative
74 , readNative
76− -- * Parser state used in readers
84 -- * Writers: converting /from/ Pandoc format
75 -- * Writers: converting /from/ Pandoc format
85 , Writer (..)
76 , Writer (..)
86 , writeNative
77 , writeNative
@@ -118,8 +109,6 @@ module Text.Pandoc
118 , rtfEmbedImage
109 , rtfEmbedImage
119 , jsonFilter
110 , jsonFilter
120 , ToJsonFilter(..)
111 , ToJsonFilter(..)
121− -- * From Data.Default
125import Text.Pandoc.Definition
114import Text.Pandoc.Definition
@@ -151,41 +140,33 @@ import Text.Pandoc.Writers.Textile
151import Text.Pandoc.Writers.Org
140import Text.Pandoc.Writers.Org
152import Text.Pandoc.Writers.AsciiDoc
141import Text.Pandoc.Writers.AsciiDoc
153import Text.Pandoc.Templates
142import Text.Pandoc.Templates
154−import Text.Pandoc.Parsing
155import Text.Pandoc.Shared
143import Text.Pandoc.Shared
156import Text.Pandoc.Options
144import Text.Pandoc.Options
157import Data.ByteString.Lazy (ByteString)
145import Data.ByteString.Lazy (ByteString)
158import Data.Version (showVersion)
146import Data.Version (showVersion)
159import Text.JSON.Generic
147import Text.JSON.Generic
160import Paths_pandoc (version)
148import Paths_pandoc (version)
163-- | Version number of pandoc library.
150-- | Version number of pandoc library.
164pandocVersion :: String
151pandocVersion :: String
165pandocVersion = showVersion version
152pandocVersion = showVersion version
167-- | Association list of formats and readers.
154-- | Association list of formats and readers.
168−readers :: [(String, ParserState -> String -> Pandoc)]
155+readers :: [(String, ReaderOptions -> String -> Pandoc)]
169readers = [("native" , \_ -> readNative)
156readers = [("native" , \_ -> readNative)
170 ,("json" , \_ -> decodeJSON)
157 ,("json" , \_ -> decodeJSON)
171 ,("markdown" , readMarkdown)
158 ,("markdown" , readMarkdown)
172− ,("markdown+lhs" , \st ->
159+ ,("markdown+lhs" , \opt ->
173− readMarkdown st{ stateOptions =
174− let oldopts = stateOptions st
175− in oldopts{ readerLiterateHaskell = True} })
160+ readMarkdown opt{ readerLiterateHaskell = True })
176 ,("rst" , readRST)
161 ,("rst" , readRST)
177− ,("rst+lhs" , \st ->
162+ ,("rst+lhs" , \opt ->
178− readRST st{ stateOptions =
179− let oldopts = stateOptions st
180− in oldopts{ readerLiterateHaskell = True} })
163+ readRST opt{ readerLiterateHaskell = True })
181 ,("docbook" , readDocBook)
164 ,("docbook" , readDocBook)
182 ,("textile" , readTextile) -- TODO : textile+lhs
165 ,("textile" , readTextile) -- TODO : textile+lhs
183 ,("html" , readHtml)
166 ,("html" , readHtml)
184 ,("latex" , readLaTeX)
167 ,("latex" , readLaTeX)
185− ,("latex+lhs" , \st ->
168+ ,("latex+lhs" , \opt ->
186− readLaTeX st{ stateOptions =
187− let oldopts = stateOptions st
188− in oldopts{ readerLiterateHaskell = True} })
169+ readLaTeX opt{ readerLiterateHaskell = True })
191data Writer = PureStringWriter (WriterOptions -> Pandoc -> String)
172data Writer = PureStringWriter (WriterOptions -> Pandoc -> String)