git.iko.soy/typeable/pandoc
on master help sign in
Org reader: respect `creator` export option

The `creator` option controls whether the creator meta-field should be included in the final markup. Setting `#+OPTIONS: creator:nil` will drop the creator field from the final meta-data output. Org-mode recognizes the special value `comment` for this field, causing the creator to be included in a comment. This is difficult to translate to Pandoc internals and is hence interpreted the same as other truish values (i.e. the meta field is kept if it's present).

commit88313c0b93694e310175a461ed74f497debbd57d authorAlbert Krewinkel <albert@zeitkraut.de> dateMon 29 Aug 2016, 14:10 (10 years ago) parent0568aa5
4 files changed+14−5
src/Text/Pandoc/Readers/Org/ExportSettings.hs+3−1 src/Text/Pandoc/Readers/Org/Meta.hs+3−4 src/Text/Pandoc/Readers/Org/ParserState.hs+2 tests/Tests/Readers/Org.hs+6
src/Text/Pandoc/Readers/Org/ExportSettings.hs+3−1
@@ -56,7 +56,9 @@ exportSetting = choice
5656 , archivedTreeSetting "arch" (\val es -> es { exportArchivedTrees = val })
5757 , booleanSetting "author" (\val es -> es { exportWithAuthor = val })
5858 , ignoredSetting "c"
59− , ignoredSetting "creator"
59+ -- org-mode allows the special value `comment` for creator, which we'll
60+ -- interpret as true as it doesn't make sense in the context of Pandoc.
61+ , booleanSetting "creator" (\val es -> es { exportWithCreator = val })
6062 , complementableListSetting "d" (\val es -> es { exportDrawers = val })
6163 , ignoredSetting "date"
6264 , ignoredSetting "e"
src/Text/Pandoc/Readers/Org/Meta.hs+3−4
@@ -54,10 +54,9 @@ metaExport :: OrgParser (F Meta)
5454metaExport = do
5555 st <- getState
5656 let settings = orgStateExportSettings st
57− let withAuthor = exportWithAuthor settings
58− let withEmail = exportWithEmail settings
59− return $ (if withAuthor then id else removeMeta "author")
60− . (if withEmail then id else removeMeta "email")
57+ return $ (if exportWithAuthor settings then id else removeMeta "author")
58+ . (if exportWithCreator settings then id else removeMeta "creator")
59+ . (if exportWithEmail settings then id else removeMeta "email")
6160 <$> orgStateMeta st
6261
6362removeMeta :: String -> Meta -> Meta
src/Text/Pandoc/Readers/Org/ParserState.hs+2
@@ -164,6 +164,7 @@ data ExportSettings = ExportSettings
164164 , exportSpecialStrings :: Bool -- ^ Parse ellipses and dashes smartly
165165 , exportSubSuperscripts :: Bool -- ^ TeX-like syntax for sub- and superscripts
166166 , exportWithAuthor :: Bool -- ^ Include author in final meta-data
167+ , exportWithCreator :: Bool -- ^ Include creator in final meta-data
167168 , exportWithEmail :: Bool -- ^ Include email in final meta-data
168169 }
169170
@@ -180,6 +181,7 @@ defaultExportSettings = ExportSettings
180181 , exportSpecialStrings = True
181182 , exportSubSuperscripts = True
182183 , exportWithAuthor = True
184+ , exportWithCreator = True
183185 , exportWithEmail = True
184186 }
185187
tests/Tests/Readers/Org.hs+6
@@ -675,6 +675,12 @@ tests =
675675 ] =?>
676676 Pandoc nullMeta mempty
677677
678+ , "disable creator export" =:
679+ unlines [ "#+OPTIONS: creator:nil"
680+ , "#+creator: The Architect"
681+ ] =?>
682+ Pandoc nullMeta mempty
683+
678684 , "disable email export" =:
679685 unlines [ "#+OPTIONS: email:nil"
680686 , "#+email: no-mail-please@example.com"