aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--test/Tests/Readers/Org/Directive.hs8
4 files changed, 15 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
}
diff --git a/test/Tests/Readers/Org/Directive.hs b/test/Tests/Readers/Org/Directive.hs
index e92b1bbb9..ba012a69f 100644
--- a/test/Tests/Readers/Org/Directive.hs
+++ b/test/Tests/Readers/Org/Directive.hs
@@ -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 "] =?>