From 8357b835d9c6d17f32bded56aa24059c2f6e0678 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 5 May 2021 19:00:53 +0200 Subject: 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 --- src/Text/Pandoc/App.hs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'src/Text') 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" || -- cgit v1.2.3