aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-03-26 19:19:54 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-03-26 19:19:54 +0200
commit453970c6b34ed7cc2f52181e5e77b9182a3639e9 (patch)
tree8866876c9147c249527c7710003049d7a7438730 /src/Text/Pandoc
parentbd99d9f6affedd476d5fe14bef267197cb3e5f55 (diff)
downloadpandoc-453970c6b34ed7cc2f52181e5e77b9182a3639e9.tar.gz
Text.Pandoc.Data: ensure it compiles even without embed_data_files.
In this case we don't depend on file-embed or use TH.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r--src/Text/Pandoc/Data.hs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Data.hs b/src/Text/Pandoc/Data.hs
index df26f5412..41ff5a0d6 100644
--- a/src/Text/Pandoc/Data.hs
+++ b/src/Text/Pandoc/Data.hs
@@ -1,11 +1,15 @@
+{-# LANGUAGE CPP #-}
+#ifdef EMBED_DATA_FILES
{-# LANGUAGE TemplateHaskell #-}
-
+#endif
module Text.Pandoc.Data (dataFiles) where
-import Data.FileEmbed
+import System.FilePath (FilePath, splitDirectories)
import qualified Data.ByteString as B
-import System.FilePath (splitDirectories)
import qualified System.FilePath.Posix as Posix
+#ifdef EMBED_DATA_FILES
+import Data.FileEmbed
+#endif
-- We ensure that the data files are stored using Posix
-- path separators (/), even on Windows.
@@ -14,4 +18,8 @@ dataFiles = map (\(fp, contents) ->
(Posix.joinPath (splitDirectories fp), contents)) dataFiles'
dataFiles' :: [(FilePath, B.ByteString)]
+#ifdef EMBED_DATA_FILES
dataFiles' = ("MANUAL.txt", $(embedFile "MANUAL.txt")) : $(embedDir "data")
+#else
+dataFiles' = error "dataFiles is only defined when embed_data_files flag set"
+#endif