aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/App.hs18
-rw-r--r--test/command/6709.md11
2 files changed, 22 insertions, 7 deletions
diff --git a/src/Text/Pandoc/App.hs b/src/Text/Pandoc/App.hs
index 4e8c9f2ab..96e4b5f47 100644
--- a/src/Text/Pandoc/App.hs
+++ b/src/Text/Pandoc/App.hs
@@ -255,13 +255,17 @@ convertWithOpts opts = do
let sourceToDoc :: [FilePath] -> PandocIO Pandoc
sourceToDoc sources' =
case reader of
- TextReader r
- | optFileScope opts || readerNameBase == "json" ->
- mconcat <$> mapM (readSource >=> r readerOpts) sources'
- | otherwise ->
- readSources sources' >>= r readerOpts
- ByteStringReader r ->
- mconcat <$> mapM (readFile' >=> r readerOpts) sources'
+ TextReader r
+ | readerNameBase == "json" ->
+ mconcat <$> mapM (readSource >=> r readerOpts) sources'
+ | optFileScope opts ->
+ -- Read source and convert tabs (see #6709)
+ let readSource' = fmap convertTabs . readSource
+ in mconcat <$> mapM (readSource' >=> r readerOpts) sources'
+ | otherwise ->
+ readSources sources' >>= r readerOpts
+ ByteStringReader r ->
+ mconcat <$> mapM (readFile' >=> r readerOpts) sources'
when (readerNameBase == "markdown_github" ||
diff --git a/test/command/6709.md b/test/command/6709.md
new file mode 100644
index 000000000..d6d514552
--- /dev/null
+++ b/test/command/6709.md
@@ -0,0 +1,11 @@
+Tabs must be expanded even if --file-scope is used
+````
+% pandoc -t native --file-scope --tab-stop=2
+```
+if true; then
+ echo "yup"
+fi
+```
+^D
+[CodeBlock ("",[],[]) "if true; then\n echo \"yup\"\nfi"]
+````