git.iko.soy/typeable/pandoc
on master help sign in
RST reader: seek include files in the directory...

...of the file containing the include directive, as RST requires. Closes #6632.

commit2a2e08d82335d45c982f4acf14b62130365f2c8e authorJohn MacFarlane <jgm@berkeley.edu> dateSun 9 May 2021, 18:50 (5 years ago) parentb2398cd
1 file changed+3−1
src/Text/Pandoc/Readers/RST.hs+3−1
src/Text/Pandoc/Readers/RST.hs+3−1
@@ -38,6 +38,7 @@ import Text.Pandoc.Parsing
3838import Text.Pandoc.Shared
3939import qualified Text.Pandoc.UTF8 as UTF8
4040import Data.Time.Format
41+import System.FilePath (takeDirectory)
4142
4243-- TODO:
4344-- [ ] .. parsed-literal
@@ -483,7 +484,8 @@ includeDirective top fields body = do
483484 Nothing -> id)
484485 let toStream t =
485486 toSources [(f, T.unlines . selectLines . T.lines $ t)]
486− insertIncludedFile parser toStream ["."] f startLine endLine
487+ currentDir <- takeDirectory . sourceName <$> getPosition
488+ insertIncludedFile parser toStream [currentDir] f startLine endLine
487489
488490--
489491-- list blocks