aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/Org
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-05-23 10:39:08 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2016-05-23 10:39:08 -0700
commit654bdf72bfe608cea1b606028a4bf9570bb63b8f (patch)
treed5c54ecb01c1d743673544d05d87ef4cedafaaca /src/Text/Pandoc/Readers/Org
parente3ca9793aa1d495ad6070ba63cb91311ec69132e (diff)
parent5667e0959a09035e155beaa1432c48828c4e9396 (diff)
downloadpandoc-654bdf72bfe608cea1b606028a4bf9570bb63b8f.tar.gz
Merge pull request #2941 from tarleb/org-drawer-improvements
Org drawer improvements
Diffstat (limited to 'src/Text/Pandoc/Readers/Org')
-rw-r--r--src/Text/Pandoc/Readers/Org/ParserState.hs15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Readers/Org/ParserState.hs b/src/Text/Pandoc/Readers/Org/ParserState.hs
index f84e5e51b..6a902cd46 100644
--- a/src/Text/Pandoc/Readers/Org/ParserState.hs
+++ b/src/Text/Pandoc/Readers/Org/ParserState.hs
@@ -39,8 +39,9 @@ module Text.Pandoc.Readers.Org.ParserState
, runF
, returnF
, ExportSettingSetter
- , exportSubSuperscripts
+ , ExportSettings (..)
, setExportSubSuperscripts
+ , setExportDrawers
, modifyExportSettings
) where
@@ -76,6 +77,10 @@ type OrgLinkFormatters = M.Map String (String -> String)
-- These settings can be changed via OPTIONS statements.
data ExportSettings = ExportSettings
{ exportSubSuperscripts :: Bool -- ^ TeX-like syntax for sub- and superscripts
+ , exportDrawers :: Either [String] [String]
+ -- ^ Specify drawer names which should be exported. @Left@ names are
+ -- explicitly excluded from the resulting output while @Right@ means that
+ -- only the listed drawer names should be included.
}
-- | Org-mode parser state
@@ -155,6 +160,7 @@ defaultOrgParserState = OrgParserState
defaultExportSettings :: ExportSettings
defaultExportSettings = ExportSettings
{ exportSubSuperscripts = True
+ , exportDrawers = Left ["LOGBOOK"]
}
@@ -163,9 +169,16 @@ defaultExportSettings = ExportSettings
--
type ExportSettingSetter a = a -> ExportSettings -> ExportSettings
+-- | Set export options for sub/superscript parsing. The short syntax will
+-- not be parsed if this is set set to @False@.
setExportSubSuperscripts :: ExportSettingSetter Bool
setExportSubSuperscripts val es = es { exportSubSuperscripts = val }
+-- | Set export options for drawers. See the @exportDrawers@ in ADT
+-- @ExportSettings@ for details.
+setExportDrawers :: ExportSettingSetter (Either [String] [String])
+setExportDrawers val es = es { exportDrawers = val }
+
-- | Modify a parser state
modifyExportSettings :: ExportSettingSetter a -> a -> OrgParserState -> OrgParserState
modifyExportSettings setter val state =