Org reader: respect tables-excluding export setting
Tables can be removed from the final document with the `#+OPTION: |:nil` export setting.
This commit is contained in:
parent
d6711bd7d9
commit
ccf9889c2c
4 changed files with 15 additions and 2 deletions
|
@ -608,7 +608,10 @@ data OrgTable = OrgTable
|
|||
}
|
||||
|
||||
table :: PandocMonad m => OrgParser m (F Blocks)
|
||||
table = gridTableWith blocks True <|> orgTable
|
||||
table = do
|
||||
withTables <- getExportSetting exportWithTables
|
||||
tbl <- gridTableWith blocks True <|> orgTable
|
||||
return $ if withTables then tbl else mempty
|
||||
|
||||
-- | A normal org table
|
||||
orgTable :: PandocMonad m => OrgParser m (F Blocks)
|
||||
|
|
|
@ -64,7 +64,7 @@ exportSetting = choice
|
|||
, ignoredSetting "title"
|
||||
, ignoredSetting "toc"
|
||||
, booleanSetting "todo" (\val es -> es { exportWithTodoKeywords = val })
|
||||
, ignoredSetting "|"
|
||||
, booleanSetting "|" (\val es -> es { exportWithTables = val })
|
||||
, ignoreAndWarn
|
||||
] <?> "export setting"
|
||||
|
||||
|
|
|
@ -262,6 +262,7 @@ data ExportSettings = ExportSettings
|
|||
, exportWithLatex :: TeXExport -- ^ Handling of raw TeX commands
|
||||
, exportWithPlanning :: Bool -- ^ Keep planning info after headlines
|
||||
, exportWithTags :: Bool -- ^ Keep tags as part of headlines
|
||||
, exportWithTables :: Bool -- ^ Include tables
|
||||
, exportWithTodoKeywords :: Bool -- ^ Keep TODO keywords in headers
|
||||
}
|
||||
|
||||
|
@ -286,5 +287,6 @@ defaultExportSettings = ExportSettings
|
|||
, exportWithLatex = TeXExport
|
||||
, exportWithPlanning = False
|
||||
, exportWithTags = True
|
||||
, exportWithTables = True
|
||||
, exportWithTodoKeywords = True
|
||||
}
|
||||
|
|
|
@ -280,6 +280,14 @@ tests =
|
|||
headerWith ("wichtig", mempty, mempty) 1 "Wichtig"
|
||||
]
|
||||
|
||||
, testGroup "Option |"
|
||||
[ "disable export of tables" =:
|
||||
T.unlines [ "#+OPTIONS: |:nil"
|
||||
, "| chair |"
|
||||
] =?>
|
||||
(mempty :: Blocks)
|
||||
]
|
||||
|
||||
, testGroup "unknown options"
|
||||
[ "unknown options are ignored" =:
|
||||
T.unlines [ "#+OPTIONS: does-not-exist:t "] =?>
|
||||
|
|
Loading…
Reference in a new issue