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:
Albert Krewinkel 2020-07-01 09:17:42 +02:00
parent d6711bd7d9
commit ccf9889c2c
No known key found for this signature in database
GPG key ID: 388DC0B21F631124
4 changed files with 15 additions and 2 deletions

View file

@ -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)

View file

@ -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"

View file

@ -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
}

View file

@ -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 "] =?>