aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Readers/Org/ExportSettings.hs2
-rw-r--r--src/Text/Pandoc/Readers/Org/Meta.hs8
-rw-r--r--src/Text/Pandoc/Readers/Org/ParserState.hs2
-rw-r--r--tests/Tests/Readers/Org.hs6
4 files changed, 13 insertions, 5 deletions
diff --git a/src/Text/Pandoc/Readers/Org/ExportSettings.hs b/src/Text/Pandoc/Readers/Org/ExportSettings.hs
index b539a8000..6233a6104 100644
--- a/src/Text/Pandoc/Readers/Org/ExportSettings.hs
+++ b/src/Text/Pandoc/Readers/Org/ExportSettings.hs
@@ -60,7 +60,7 @@ exportSetting = choice
, complementableListSetting "d" (\val es -> es { exportDrawers = val })
, ignoredSetting "date"
, ignoredSetting "e"
- , ignoredSetting "email"
+ , booleanSetting "email" (\val es -> es { exportWithEmail = val })
, ignoredSetting "f"
, integerSetting "H" (\val es -> es { exportHeadlineLevels = val })
, ignoredSetting "inline"
diff --git a/src/Text/Pandoc/Readers/Org/Meta.hs b/src/Text/Pandoc/Readers/Org/Meta.hs
index 4d74713d6..a20c25e09 100644
--- a/src/Text/Pandoc/Readers/Org/Meta.hs
+++ b/src/Text/Pandoc/Readers/Org/Meta.hs
@@ -53,8 +53,11 @@ import Network.HTTP ( urlEncode )
metaExport :: OrgParser (F Meta)
metaExport = do
st <- getState
- let withAuthor = extractExportOption exportWithAuthor st
+ let settings = orgStateExportSettings st
+ let withAuthor = exportWithAuthor settings
+ let withEmail = exportWithEmail settings
return $ (if withAuthor then id else removeMeta "author")
+ . (if withEmail then id else removeMeta "email")
<$> orgStateMeta st
removeMeta :: String -> Meta -> Meta
@@ -62,9 +65,6 @@ removeMeta key meta' =
let metaMap = unMeta meta'
in Meta $ M.delete key metaMap
-extractExportOption :: (ExportSettings -> a) -> OrgParserState -> a
-extractExportOption ex = ex . orgStateExportSettings
-
-- | Parse and handle a single line containing meta information
-- The order, in which blocks are tried, makes sure that we're not looking at
-- the beginning of a block, so we don't need to check for it
diff --git a/src/Text/Pandoc/Readers/Org/ParserState.hs b/src/Text/Pandoc/Readers/Org/ParserState.hs
index 661ccc4ea..4c3aa298c 100644
--- a/src/Text/Pandoc/Readers/Org/ParserState.hs
+++ b/src/Text/Pandoc/Readers/Org/ParserState.hs
@@ -164,6 +164,7 @@ data ExportSettings = ExportSettings
, exportSpecialStrings :: Bool -- ^ Parse ellipses and dashes smartly
, exportSubSuperscripts :: Bool -- ^ TeX-like syntax for sub- and superscripts
, exportWithAuthor :: Bool -- ^ Include author in final meta-data
+ , exportWithEmail :: Bool -- ^ Include email in final meta-data
}
instance Default ExportSettings where
@@ -179,6 +180,7 @@ defaultExportSettings = ExportSettings
, exportSpecialStrings = True
, exportSubSuperscripts = True
, exportWithAuthor = True
+ , exportWithEmail = True
}
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
index 2ef847f30..5191f63d5 100644
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -674,6 +674,12 @@ tests =
, "#+AUTHOR: ShyGuy"
] =?>
Pandoc nullMeta mempty
+
+ , "disable email export" =:
+ unlines [ "#+OPTIONS: email:nil"
+ , "#+email: no-mail-please@example.com"
+ ] =?>
+ Pandoc nullMeta mempty
]
]