aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/App/OutputSettings.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-05-04 09:04:30 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-05-04 09:07:50 -0700
commitfee3258280959a741fbdddb1eeb4b1ef2ab14e6d (patch)
tree9c7b962be3d7f6b72343cb5964108108f7df3b30 /src/Text/Pandoc/App/OutputSettings.hs
parent2fa8c0dc96bd79c8688cb621e330f325589847a6 (diff)
downloadpandoc-fee3258280959a741fbdddb1eeb4b1ef2ab14e6d.tar.gz
Add template variable `curdir` with working directory
from which pandoc is run. Closes #5464.
Diffstat (limited to 'src/Text/Pandoc/App/OutputSettings.hs')
-rw-r--r--src/Text/Pandoc/App/OutputSettings.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Text/Pandoc/App/OutputSettings.hs b/src/Text/Pandoc/App/OutputSettings.hs
index babec8745..343287a4b 100644
--- a/src/Text/Pandoc/App/OutputSettings.hs
+++ b/src/Text/Pandoc/App/OutputSettings.hs
@@ -28,6 +28,7 @@ import Data.List (find, isPrefixOf, isSuffixOf)
import Data.Maybe (fromMaybe)
import Skylighting (defaultSyntaxMap)
import Skylighting.Parser (addSyntaxDefinition, parseSyntaxDefinition)
+import System.Directory (getCurrentDirectory)
import System.Exit (exitSuccess)
import System.FilePath
import System.IO (stdout)
@@ -113,6 +114,8 @@ optToOutputSettings opts = do
s <- UTF8.toString . fst <$> fetchItem fp
return $ (varname, s) : vars
+ curdir <- liftIO getCurrentDirectory
+
variables <-
withList (addStringAsVariable "sourcefile")
(reverse $ optInputFiles opts)
@@ -140,6 +143,8 @@ optToOutputSettings opts = do
maybe return (addStringAsVariable "epub-cover-image")
(optEpubCoverImage opts)
>>=
+ addStringAsVariable "curdir" curdir
+ >>=
(\vars -> if format == "dzslides"
then do
dztempl <- UTF8.toString <$> readDataFile