From 2a2e08d82335d45c982f4acf14b62130365f2c8e Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 9 May 2021 18:50:41 -0600 Subject: RST reader: seek include files in the directory... ...of the file containing the include directive, as RST requires. Closes #6632. --- src/Text/Pandoc/Readers/RST.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Text/Pandoc/Readers/RST.hs b/src/Text/Pandoc/Readers/RST.hs index bb70b2620..35292d949 100644 --- a/src/Text/Pandoc/Readers/RST.hs +++ b/src/Text/Pandoc/Readers/RST.hs @@ -38,6 +38,7 @@ import Text.Pandoc.Parsing import Text.Pandoc.Shared import qualified Text.Pandoc.UTF8 as UTF8 import Data.Time.Format +import System.FilePath (takeDirectory) -- TODO: -- [ ] .. parsed-literal @@ -483,7 +484,8 @@ includeDirective top fields body = do Nothing -> id) let toStream t = toSources [(f, T.unlines . selectLines . T.lines $ t)] - insertIncludedFile parser toStream ["."] f startLine endLine + currentDir <- takeDirectory . sourceName <$> getPosition + insertIncludedFile parser toStream [currentDir] f startLine endLine -- -- list blocks -- cgit v1.2.3