Have LoadedResource use relative paths.

The immediate reason for this is to allow the test output of #3752
to work on both windows and linux.
This commit is contained in:
John MacFarlane 2021-05-30 10:22:02 -07:00
parent c2f46e6df4
commit cc206af392
2 changed files with 5 additions and 5 deletions

View file

@ -66,7 +66,7 @@ import Network.URI ( escapeURIString, nonStrictRelativeTo,
unEscapeString, parseURIReference, isAllowedInURI,
parseURI, URI(..) )
import System.FilePath ((</>), takeExtension, dropExtension,
isRelative, splitDirectories)
isRelative, splitDirectories, makeRelative)
import System.Random (StdGen)
import Text.Collate.Lang (Lang(..), parseLang, renderLang)
import Text.Pandoc.Class.CommonState (CommonState (..))
@ -413,7 +413,7 @@ downloadOrRead s = do
(fp', cont) <- if isRelative f
then withPaths resourcePath readFileStrict f
else (f,) <$> readFileStrict f
report $ LoadedResource f fp'
report $ LoadedResource f (makeRelative "." fp')
return (cont, mime)
httpcolon = URI{ uriScheme = "http:",
uriAuthority = Nothing,

View file

@ -1,9 +1,9 @@
```
% pandoc command/chap1/text.md command/chap2/text.md -f markdown+rebase_relative_paths --verbose -t docx -o - | pandoc -f docx -t plain
^D
[INFO] Loaded command/chap1/spider.png from ./command/chap1/spider.png
[INFO] Loaded command/chap2/spider.png from ./command/chap2/spider.png
[INFO] Loaded command/chap1/../../lalune.jpg from ./command/chap1/../../lalune.jpg
[INFO] Loaded command/chap1/spider.png from command/chap1/spider.png
[INFO] Loaded command/chap2/spider.png from command/chap2/spider.png
[INFO] Loaded command/chap1/../../lalune.jpg from command/chap1/../../lalune.jpg
Chapter one
A spider: [spider]