From d6711bd7d98d69541e8617236c2f2c358dd67307 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Tue, 30 Jun 2020 22:19:46 +0200 Subject: Org reader: respect export setting disabling footnotes Footnotes can be removed from the final document with the `#+OPTION: f:nil` export setting. --- src/Text/Pandoc/Readers/Org/ExportSettings.hs | 2 +- src/Text/Pandoc/Readers/Org/Inlines.hs | 5 ++++- src/Text/Pandoc/Readers/Org/ParserState.hs | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src/Text/Pandoc/Readers') 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 -- cgit v1.2.3