@@ -43,6 +43,7 @@ module Text.Pandoc.Readers.Org.ParserState
4343 , ExportSettingSetter
4444 , ExportSettings (..)
4545 , setExportDrawers
46+ , setExportEmphasizedText
4647 , setExportSmartQuotes
4748 , setExportSubSuperscripts
4849 , modifyExportSettings
@@ -83,26 +84,27 @@ data ExportSettings = ExportSettings
8384 -- ^ Specify drawer names which should be exported. @Left@ names are
8485 -- explicitly excluded from the resulting output while @Right@ means that
8586 -- only the listed drawer names should be included.
87+ , exportEmphasizedText :: Bool -- ^ Parse emphasized text.
8688 , exportSmartQuotes :: Bool -- ^ Parse quotes, ellipses, apostrophs smartly
8789 , exportSubSuperscripts :: Bool -- ^ TeX-like syntax for sub- and superscripts
8890 }
8991
9092-- | Org-mode parser state
9193data OrgParserState = OrgParserState
92− { orgStateOptions :: ReaderOptions
93− , orgStateAnchorIds :: [String]
94+ { orgStateAnchorIds :: [String]
9495 , orgStateEmphasisCharStack :: [Char]
9596 , orgStateEmphasisNewlines :: Maybe Int
9697 , orgStateExportSettings :: ExportSettings
98+ , orgStateHeaderMap :: M.Map Inlines String
99+ , orgStateIdentifiers :: Set.Set String
97100 , orgStateLastForbiddenCharPos :: Maybe SourcePos
98101 , orgStateLastPreCharPos :: Maybe SourcePos
99102 , orgStateLastStrPos :: Maybe SourcePos
100103 , orgStateLinkFormatters :: OrgLinkFormatters
101104 , orgStateMeta :: F Meta
102105 , orgStateNotes' :: OrgNoteTable
106+ , orgStateOptions :: ReaderOptions
103107 , orgStateParserContext :: ParserContext
104− , orgStateIdentifiers :: Set.Set String
105− , orgStateHeaderMap :: M.Map Inlines String
106108 }
107109
108110data OrgParserLocal = OrgParserLocal { orgLocalQuoteContext :: QuoteContext }
@@ -137,25 +139,26 @@ instance Default OrgParserState where
137139
138140defaultOrgParserState :: OrgParserState
139141defaultOrgParserState = OrgParserState
140− { orgStateOptions = def
141− , orgStateAnchorIds = []
142+ { orgStateAnchorIds = []
142143 , orgStateEmphasisCharStack = []
143144 , orgStateEmphasisNewlines = Nothing
144145 , orgStateExportSettings = def
146+ , orgStateHeaderMap = M.empty
147+ , orgStateIdentifiers = Set.empty
145148 , orgStateLastForbiddenCharPos = Nothing
146149 , orgStateLastPreCharPos = Nothing
147150 , orgStateLastStrPos = Nothing
148151 , orgStateLinkFormatters = M.empty
149152 , orgStateMeta = return nullMeta
150153 , orgStateNotes' = []
154+ , orgStateOptions = def
151155 , orgStateParserContext = NullState
152− , orgStateIdentifiers = Set.empty
153− , orgStateHeaderMap = M.empty
154156 }
155157
156158defaultExportSettings :: ExportSettings
157159defaultExportSettings = ExportSettings
158160 { exportDrawers = Left ["LOGBOOK"]
161+ , exportEmphasizedText = True
159162 , exportSmartQuotes = True
160163 , exportSubSuperscripts = True
161164 }
@@ -175,13 +178,16 @@ type ExportSettingSetter a = a -> ExportSettings -> ExportSettings
175178setExportDrawers :: ExportSettingSetter (Either [String] [String])
176179setExportDrawers val es = es { exportDrawers = val }
177180
181+-- | Set export options for emphasis parsing.
182+setExportEmphasizedText :: ExportSettingSetter Bool
183+setExportEmphasizedText val es = es { exportEmphasizedText = val }
184+
178185-- | Set export options for sub/superscript parsing. The short syntax will
179186-- not be parsed if this is set set to @False@.
180187setExportSubSuperscripts :: ExportSettingSetter Bool
181188setExportSubSuperscripts val es = es { exportSubSuperscripts = val }
182189
183−-- | Set export options for sub/superscript parsing. The short syntax will
184−-- not be parsed if this is set set to @False@.
190+-- | Set export options for parsing of smart quotes.
185191setExportSmartQuotes :: ExportSettingSetter Bool
186192setExportSmartQuotes val es = es { exportSmartQuotes = val }
187193