diff options
-rw-r--r-- | src/Text/Pandoc/Data.hs | 14 |
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 |