Org reader: respect export setting disabling footnotes
Footnotes can be removed from the final document with the `#+OPTION: f:nil` export setting.
This commit is contained in:
parent
efbc205031
commit
d6711bd7d9
4 changed files with 23 additions and 2 deletions
|
@ -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"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -156,6 +156,22 @@ tests =
|
|||
] =?>
|
||||
para "Icelandic letter: \\thorn"
|
||||
|
||||
, testGroup "Option f"
|
||||
[ "disable inline footnotes" =:
|
||||
T.unlines [ "#+OPTIONS: f:nil"
|
||||
, "Funny![fn:funny:or not]"
|
||||
] =?>
|
||||
para "Funny!"
|
||||
|
||||
, "disable reference footnotes" =:
|
||||
T.unlines [ "#+OPTIONS: f:nil"
|
||||
, "Burn everything[fn:1] down!"
|
||||
, ""
|
||||
, "[fn:2] Not quite everything."
|
||||
] =?>
|
||||
para "Burn everything down!"
|
||||
]
|
||||
|
||||
, "disable inclusion of todo keywords" =:
|
||||
T.unlines [ "#+OPTIONS: todo:nil"
|
||||
, "** DONE todo export"
|
||||
|
|
Loading…
Add table
Reference in a new issue