From f145aea0f9037f9d957d59ed8608401e7219fbf3 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Thu, 29 Jul 2021 14:54:25 -0600 Subject: 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. --- src/Text/Pandoc/Parsing.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Text/Pandoc') 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 -- cgit v1.2.3