@@ -42,9 +42,11 @@ module Text.Pandoc.Readers.Org.ParserState
43 , ExportSettingSetter
43 , ExportSettingSetter
44 , ExportSettings (..)
44 , ExportSettings (..)
45− , setExportSubSuperscripts
46 , setExportDrawers
45 , setExportDrawers
46+ , setExportSmartQuotes
47+ , setExportSubSuperscripts
47 , modifyExportSettings
48 , modifyExportSettings
49+ , optionsToParserState
50import Control.Monad (liftM, liftM2)
52import Control.Monad (liftM, liftM2)
@@ -77,11 +79,12 @@ type OrgLinkFormatters = M.Map String (String -> String)
77-- | Export settings <http://orgmode.org/manual/Export-settings.html>
79-- | Export settings <http://orgmode.org/manual/Export-settings.html>
78-- These settings can be changed via OPTIONS statements.
80-- These settings can be changed via OPTIONS statements.
79data ExportSettings = ExportSettings
81data ExportSettings = ExportSettings
80− { exportSubSuperscripts :: Bool -- ^ TeX-like syntax for sub- and superscripts
81− , exportDrawers :: Either [String] [String]
82+ { exportDrawers :: Either [String] [String]
82 -- ^ Specify drawer names which should be exported. @Left@ names are
83 -- ^ Specify drawer names which should be exported. @Left@ names are
83 -- explicitly excluded from the resulting output while @Right@ means that
84 -- explicitly excluded from the resulting output while @Right@ means that
84 -- only the listed drawer names should be included.
85 -- only the listed drawer names should be included.
86+ , exportSmartQuotes :: Bool -- ^ Parse quotes, ellipses, apostrophs smartly
87+ , exportSubSuperscripts :: Bool -- ^ TeX-like syntax for sub- and superscripts
87-- | Org-mode parser state
90-- | Org-mode parser state
@@ -152,25 +155,35 @@ defaultOrgParserState = OrgParserState
153defaultExportSettings :: ExportSettings
156defaultExportSettings :: ExportSettings
154defaultExportSettings = ExportSettings
157defaultExportSettings = ExportSettings
155− { exportSubSuperscripts = True
156− , exportDrawers = Left ["LOGBOOK"]
158+ { exportDrawers = Left ["LOGBOOK"]
159+ , exportSmartQuotes = True
160+ , exportSubSuperscripts = True
163+optionsToParserState :: ReaderOptions -> OrgParserState
164+optionsToParserState opts =
165+ def { orgStateOptions = opts }
161-- Setter for exporting options
169-- Setter for exporting options
163type ExportSettingSetter a = a -> ExportSettings -> ExportSettings
171type ExportSettingSetter a = a -> ExportSettings -> ExportSettings
173+-- | Set export options for drawers. See the @exportDrawers@ in ADT
174+-- @ExportSettings@ for details.
175+setExportDrawers :: ExportSettingSetter (Either [String] [String])
176+setExportDrawers val es = es { exportDrawers = val }
165-- | Set export options for sub/superscript parsing. The short syntax will
178-- | Set export options for sub/superscript parsing. The short syntax will
166-- not be parsed if this is set set to @False@.
179-- not be parsed if this is set set to @False@.
167setExportSubSuperscripts :: ExportSettingSetter Bool
180setExportSubSuperscripts :: ExportSettingSetter Bool
168setExportSubSuperscripts val es = es { exportSubSuperscripts = val }
181setExportSubSuperscripts val es = es { exportSubSuperscripts = val }
170−-- | Set export options for drawers. See the @exportDrawers@ in ADT
183+-- | Set export options for sub/superscript parsing. The short syntax will
171−-- @ExportSettings@ for details.
184+-- not be parsed if this is set set to @False@.
172−setExportDrawers :: ExportSettingSetter (Either [String] [String])
185+setExportSmartQuotes :: ExportSettingSetter Bool
173−setExportDrawers val es = es { exportDrawers = val }
186+setExportSmartQuotes val es = es { exportSmartQuotes = val }
175-- | Modify a parser state
188-- | Modify a parser state
176modifyExportSettings :: ExportSettingSetter a -> a -> OrgParserState -> OrgParserState
189modifyExportSettings :: ExportSettingSetter a -> a -> OrgParserState -> OrgParserState