diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2020-06-30 22:19:46 +0200 |
---|---|---|
committer | Albert Krewinkel <albert@zeitkraut.de> | 2020-06-30 22:30:15 +0200 |
commit | d6711bd7d98d69541e8617236c2f2c358dd67307 (patch) | |
tree | 284696635cac3833311d5db277bf64c317eb0674 /src/Text/Pandoc/Readers | |
parent | efbc2050315b60c8a753dee6255465f1083019ab (diff) | |
download | pandoc-d6711bd7d98d69541e8617236c2f2c358dd67307.tar.gz |
Org reader: respect export setting disabling footnotes
Footnotes can be removed from the final document with the `#+OPTION:
f:nil` export setting.
Diffstat (limited to 'src/Text/Pandoc/Readers')
-rw-r--r-- | src/Text/Pandoc/Readers/Org/ExportSettings.hs | 2 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Org/Inlines.hs | 5 | ||||
-rw-r--r-- | src/Text/Pandoc/Readers/Org/ParserState.hs | 2 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Org/ExportSettings.hs b/src/Text/Pandoc/Readers/Org/ExportSettings.hs index 206c8ba92..6a628bdd2 100644 --- a/src/Text/Pandoc/Readers/Org/ExportSettings.hs +++ b/src/Text/Pandoc/Readers/Org/ExportSettings.hs @@ -49,7 +49,7 @@ exportSetting = choice , ignoredSetting "date" , booleanSetting "e" (\val es -> es { exportWithEntities = val }) , booleanSetting "email" (\val es -> es { exportWithEmail = val }) - , ignoredSetting "f" + , booleanSetting "f" (\val es -> es { exportWithFootnotes = val }) , integerSetting "H" (\val es -> es { exportHeadlineLevels = val }) , ignoredSetting "inline" , ignoredSetting "num" diff --git a/src/Text/Pandoc/Readers/Org/Inlines.hs b/src/Text/Pandoc/Readers/Org/Inlines.hs index 13b1315b8..b234bee58 100644 --- a/src/Text/Pandoc/Readers/Org/Inlines.hs +++ b/src/Text/Pandoc/Readers/Org/Inlines.hs @@ -378,7 +378,10 @@ citation = try $ do else rest footnote :: PandocMonad m => OrgParser m (F Inlines) -footnote = try $ inlineNote <|> referencedNote +footnote = try $ do + note <- inlineNote <|> referencedNote + withNote <- getExportSetting exportWithFootnotes + return $ if withNote then note else mempty inlineNote :: PandocMonad m => OrgParser m (F Inlines) inlineNote = try $ do diff --git a/src/Text/Pandoc/Readers/Org/ParserState.hs b/src/Text/Pandoc/Readers/Org/ParserState.hs index ac826b6f9..ec316e316 100644 --- a/src/Text/Pandoc/Readers/Org/ParserState.hs +++ b/src/Text/Pandoc/Readers/Org/ParserState.hs @@ -258,6 +258,7 @@ data ExportSettings = ExportSettings , exportWithCreator :: Bool -- ^ Include creator in final meta-data , exportWithEmail :: Bool -- ^ Include email in final meta-data , exportWithEntities :: Bool -- ^ Include MathML-like entities + , exportWithFootnotes :: Bool -- ^ Include footnotes , exportWithLatex :: TeXExport -- ^ Handling of raw TeX commands , exportWithPlanning :: Bool -- ^ Keep planning info after headlines , exportWithTags :: Bool -- ^ Keep tags as part of headlines @@ -281,6 +282,7 @@ defaultExportSettings = ExportSettings , exportWithCreator = True , exportWithEmail = True , exportWithEntities = True + , exportWithFootnotes = True , exportWithLatex = TeXExport , exportWithPlanning = False , exportWithTags = True |