@@ -42,9 +42,11 @@ module Text.Pandoc.Readers.Org.ParserState
4242 , returnF
4343 , ExportSettingSetter
4444 , ExportSettings (..)
45− , setExportSubSuperscripts
4645 , setExportDrawers
46+ , setExportSmartQuotes
47+ , setExportSubSuperscripts
4748 , modifyExportSettings
49+ , optionsToParserState
4850 ) where
4951
5052import Control.Monad (liftM, liftM2)
@@ -77,11 +79,12 @@ type OrgLinkFormatters = M.Map String (String -> String)
7779-- | Export settings <http://orgmode.org/manual/Export-settings.html>
7880-- These settings can be changed via OPTIONS statements.
7981data ExportSettings = ExportSettings
80− { exportSubSuperscripts :: Bool -- ^ TeX-like syntax for sub- and superscripts
81− , exportDrawers :: Either [String] [String]
82+ { exportDrawers :: Either [String] [String]
8283 -- ^ Specify drawer names which should be exported. @Left@ names are
8384 -- explicitly excluded from the resulting output while @Right@ means that
8485 -- 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
8588 }
8689
8790-- | Org-mode parser state
@@ -152,25 +155,35 @@ defaultOrgParserState = OrgParserState
152155
153156defaultExportSettings :: ExportSettings
154157defaultExportSettings = ExportSettings
155− { exportSubSuperscripts = True
156− , exportDrawers = Left ["LOGBOOK"]
158+ { exportDrawers = Left ["LOGBOOK"]
159+ , exportSmartQuotes = True
160+ , exportSubSuperscripts = True
157161 }
158162
163+optionsToParserState :: ReaderOptions -> OrgParserState
164+optionsToParserState opts =
165+ def { orgStateOptions = opts }
166+
159167
160168--
161169-- Setter for exporting options
162170--
163171type ExportSettingSetter a = a -> ExportSettings -> ExportSettings
164172
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 }
177+
165178-- | Set export options for sub/superscript parsing. The short syntax will
166179-- not be parsed if this is set set to @False@.
167180setExportSubSuperscripts :: ExportSettingSetter Bool
168181setExportSubSuperscripts val es = es { exportSubSuperscripts = val }
169182
170−-- | Set export options for drawers. See the @exportDrawers@ in ADT
171−-- @ExportSettings@ for details.
172−setExportDrawers :: ExportSettingSetter (Either [String] [String])
173−setExportDrawers val es = es { exportDrawers = val }
183+-- | Set export options for sub/superscript parsing. The short syntax will
184+-- not be parsed if this is set set to @False@.
185+setExportSmartQuotes :: ExportSettingSetter Bool
186+setExportSmartQuotes val es = es { exportSmartQuotes = val }
174187
175188-- | Modify a parser state
176189modifyExportSettings :: ExportSettingSetter a -> a -> OrgParserState -> OrgParserState