diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2016-08-29 14:10:58 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2016-08-29 14:34:39 +0200 |
commit | 0568aa5cad5ca5501dc0565b0e341fc5393f67e2 (patch) | |
tree | 319e492bb0f58d50548d4fd7f0b7f2945eff8bae /src | |
parent | 117d3f4d92d5096cfa51305db6d2fa261ef87d24 (diff) | |
download | pandoc-0568aa5cad5ca5501dc0565b0e341fc5393f67e2.tar.gz |
Org reader: respect `email` export option
The `email` option controls whether the email meta-field should be
included in the final markup. Setting `#+OPTIONS: email:nil` will drop
the email field from the final meta-data output.
Diffstat (limited to 'src')
-rw-r--r-- | src/Text/Pandoc/Readers/Org/ExportSettings.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Org/Meta.hs | 8 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Org/ParserState.hs | 2 |
3 files changed, 7 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 } |