git.iko.soy/typeable/pandoc
on master help sign in
App: allow tabs expansion even if file-scope is used
8357b83Albert Krewinkel
src/Text/Pandoc/App.hs+11−7
@@ -255,13 +255,17 @@ convertWithOpts opts = do
255 let sourceToDoc :: [FilePath] -> PandocIO Pandoc
255 let sourceToDoc :: [FilePath] -> PandocIO Pandoc
256 sourceToDoc sources' =
256 sourceToDoc sources' =
257 case reader of
257 case reader of
258− TextReader r
258+ TextReader r
259− | optFileScope opts || readerNameBase == "json" ->
259+ | readerNameBase == "json" ->
260+ mconcat <$> mapM (readSource >=> r readerOpts) sources'
261+ | optFileScope opts ->
262+ -- Read source and convert tabs (see #6709)
263+ let readSource' = fmap convertTabs . readSource
260− mconcat <$> mapM (readSource >=> r readerOpts) sources'
264+ in mconcat <$> mapM (readSource' >=> r readerOpts) sources'
261− | otherwise ->
265+ | otherwise ->
262− readSources sources' >>= r readerOpts
266+ readSources sources' >>= r readerOpts
263− ByteStringReader r ->
267+ ByteStringReader r ->
264− mconcat <$> mapM (readFile' >=> r readerOpts) sources'
268+ mconcat <$> mapM (readFile' >=> r readerOpts) sources'
265
269
266
270
267 when (readerNameBase == "markdown_github" ||
271 when (readerNameBase == "markdown_github" ||
test/command/6709.mdnew file+11
@@ -0,0 +1,11 @@
1+Tabs must be expanded even if --file-scope is used
2+````
3+% pandoc -t native --file-scope --tab-stop=2
4+```
5+if true; then
6+ echo "yup"
7+fi
8+```
9+^D
10+[CodeBlock ("",[],[]) "if true; then\n echo \"yup\"\nfi"]
11+````