aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-07-29 14:54:25 -0600
committerJohn MacFarlane <jgm@berkeley.edu>2021-07-29 14:54:25 -0600
commitf145aea0f9037f9d957d59ed8608401e7219fbf3 (patch)
tree0c1b679d1e039e1e51e8c2142cfe47ed9b2d031a /src/Text/Pandoc
parent1f1a30bbf6aa6d1c1dc60ac9d97560346066d02f (diff)
downloadpandoc-f145aea0f9037f9d957d59ed8608401e7219fbf3.tar.gz
parseFromString: preserve at least the source directory.
Previously we just set the source name to "chunk" when parsing from strings, to avoid misleading source positions. This had the side effect that `rebase_relative_paths` would break inside sections that were parsed as strings. So, now we use "ORIGINAL_SOURCE_PATH_chunk" instead of just "chunk". Closes #7464.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Parsing.hs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/Text/Pandoc/Parsing.hs b/src/Text/Pandoc/Parsing.hs
index 09445622d..cfda4bad2 100644
--- a/src/Text/Pandoc/Parsing.hs
+++ b/src/Text/Pandoc/Parsing.hs
@@ -599,9 +599,9 @@ parseFromString :: Monad m
-> ParserT Sources st m r
parseFromString parser str = do
oldPos <- getPosition
- setPosition $ initialPos "chunk"
oldInput <- getInput
setInput $ toSources str
+ setPosition $ initialPos $ sourceName oldPos <> "_chunk"
result <- parser
spaces
setInput oldInput