aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2021-05-09 18:50:41 -0600
committerJohn MacFarlane <jgm@berkeley.edu>2021-05-09 19:11:35 -0600
commit2a2e08d82335d45c982f4acf14b62130365f2c8e (patch)
tree4d80f289db4dce02e59d790fd584a51ebb88e8e6 /src/Text/Pandoc
parentb2398cd74744ce34fa10cc34f4051555f21feb2c (diff)
downloadpandoc-2a2e08d82335d45c982f4acf14b62130365f2c8e.tar.gz
RST reader: seek include files in the directory...
...of the file containing the include directive, as RST requires. Closes #6632.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Readers/RST.hs4
1 files changed, 3 insertions, 1 deletions
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