aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2020-07-01 09:17:42 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2020-07-01 09:28:24 +0200
commitccf9889c2c5839166be4296944c45447474f2a33 (patch)
tree2f78882a6e0d4f646fd331e57251624e031a3995 /src
parentd6711bd7d98d69541e8617236c2f2c358dd67307 (diff)
downloadpandoc-ccf9889c2c5839166be4296944c45447474f2a33.tar.gz
Org reader: respect tables-excluding export setting
Tables can be removed from the final document with the `#+OPTION: |:nil` export setting.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Readers/Org/Blocks.hs5
-rw-r--r--src/Text/Pandoc/Readers/Org/ExportSettings.hs2
-rw-r--r--src/Text/Pandoc/Readers/Org/ParserState.hs2
3 files changed, 7 insertions, 2 deletions
diff --git a/src/Text/Pandoc/Readers/Org/Blocks.hs b/src/Text/Pandoc/Readers/Org/Blocks.hs
index 0e2f49a83..c60817d1b 100644
--- a/src/Text/Pandoc/Readers/Org/Blocks.hs
+++ b/src/Text/Pandoc/Readers/Org/Blocks.hs
@@ -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)
diff --git a/src/Text/Pandoc/Readers/Org/ExportSettings.hs b/src/Text/Pandoc/Readers/Org/ExportSettings.hs
index 6a628bdd2..9399ebd54 100644
--- a/src/Text/Pandoc/Readers/Org/ExportSettings.hs
+++ b/src/Text/Pandoc/Readers/Org/ExportSettings.hs
@@ -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"
diff --git a/src/Text/Pandoc/Readers/Org/ParserState.hs b/src/Text/Pandoc/Readers/Org/ParserState.hs
index ec316e316..6e2e86373 100644
--- a/src/Text/Pandoc/Readers/Org/ParserState.hs
+++ b/src/Text/Pandoc/Readers/Org/ParserState.hs
@@ -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
}