aboutsummaryrefslogtreecommitdiff
path: root/src/Text
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-05-05 19:00:53 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2021-05-05 19:09:21 +0200
commit8357b835d9c6d17f32bded56aa24059c2f6e0678 (patch)
treee93428fe479e1449054a6d4f51630a6eed13fb18 /src/Text
parentddbf83f62c8bb6516203c99acd894c404351b5ae (diff)
downloadpandoc-8357b835d9c6d17f32bded56aa24059c2f6e0678.tar.gz
App: allow tabs expansion even if file-scope is used
Tabs in plain-text inputs are now handled correctly, even if the `--file-scope` flag is used. Closes: #6709
Diffstat (limited to 'src/Text')
-rw-r--r--src/Text/Pandoc/App.hs18
1 files changed, 11 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" ||