aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2019-11-28 21:36:35 +0000
committerSean Whitton <spwhitton@spwhitton.name>2019-11-28 21:36:35 +0000
commitb08997cd90c9eef58e5e3059688295db62037cdb (patch)
tree1cfcd12645b3bdc4ab6b520755f1c961382185ff /src
parent45688c8253fe61907f2743c267d65950cf74c4b5 (diff)
downloadpandoc-citeproc-preamble-b08997cd90c9eef58e5e3059688295db62037cdb.tar.gz
Update for pandoc-types >=1.20
Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
Diffstat (limited to 'src')
-rw-r--r--src/pandoc-citeproc-preamble.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/pandoc-citeproc-preamble.hs b/src/pandoc-citeproc-preamble.hs
index b446579..4716e4a 100644
--- a/src/pandoc-citeproc-preamble.hs
+++ b/src/pandoc-citeproc-preamble.hs
@@ -21,11 +21,13 @@
<http://www.gnu.org/licenses/>.
-}
+{-# LANGUAGE OverloadedStrings #-}
-import Data.List (isPrefixOf)
-import System.Directory (doesFileExist)
-import System.FilePath ((<.>), (</>))
-import System.Process (readProcess)
+import Data.List (isPrefixOf)
+import Data.Text.Conversions (convertText)
+import System.Directory (doesFileExist)
+import System.FilePath ((<.>), (</>))
+import System.Process (readProcess)
import Text.Pandoc.JSON
insertPreamble :: Block -> [Block] -> [Block]
@@ -45,7 +47,8 @@ doPreamble maybeFormat input@(Pandoc meta blocks) =
>>= maybe (return input)
(\file -> do
ls <- readFile file
- return $ Pandoc meta (insertPreamble (lsBlock ls) blocks))
+ return $
+ Pandoc meta (insertPreamble (lsBlock $ convertText ls) blocks))
where
lsBlock ls = RawBlock format ls
format = maybe (Format "latex") id maybeFormat
@@ -57,7 +60,8 @@ findPreambleFile (Format format) meta =
Nothing -> tryDatadir
where
tryDatadir = do
- defaultPreamble <- (</> "citeproc-preamble" </> "default" <.> format)
+ defaultPreamble <- (</> "citeproc-preamble" </> "default" <.>
+ convertText format)
<$> getPandocDatadir
doesFileExist defaultPreamble >>= \exists ->
return $ if exists then Just defaultPreamble else Nothing
@@ -70,7 +74,7 @@ getPandocDatadir =
prefix = "Default user data directory: "
toPath :: MetaValue -> Maybe String
-toPath (MetaString s) = Just s
+toPath (MetaString s) = Just $ convertText s
toPath _ = Nothing
main :: IO ()