diff options
author | John MacFarlane <jgm@berkeley.edu> | 2017-03-26 19:19:54 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2017-03-26 19:19:54 +0200 |
commit | 453970c6b34ed7cc2f52181e5e77b9182a3639e9 (patch) | |
tree | 8866876c9147c249527c7710003049d7a7438730 /src/Text/Pandoc | |
parent | bd99d9f6affedd476d5fe14bef267197cb3e5f55 (diff) | |
download | pandoc-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.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 |