diff options
author | John MacFarlane <jgm@berkeley.edu> | 2015-06-28 20:59:18 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2015-06-28 20:59:18 -0700 |
commit | 7bbb0073595ad7250317c3a348b70d3a3f948a99 (patch) | |
tree | 8a53e5efac72f21bbcba858e797d2fffa0431c19 /src/Text/Pandoc/Shared.hs | |
parent | fe625e053d078e03d824a1df746196b8a2c697b1 (diff) | |
download | pandoc-7bbb0073595ad7250317c3a348b70d3a3f948a99.tar.gz |
Minor fixes to previous commit.
* Instead of defining readmeFile in Text.Pandoc.Data (which we forgot
to export anyway), we simply add a record for "README" to the
`dataFiles` lookup table. This allows simplifying some of the code
for `readDefaultDataFile` in SHared.
* As a bonus, `pandoc --print-default-data-file README` now works.
Diffstat (limited to 'src/Text/Pandoc/Shared.hs')
-rw-r--r-- | src/Text/Pandoc/Shared.hs | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs index 2090e1734..7a4753327 100644 --- a/src/Text/Pandoc/Shared.hs +++ b/src/Text/Pandoc/Shared.hs @@ -132,7 +132,7 @@ import qualified Data.Text as T (toUpper, pack, unpack) import Data.ByteString.Lazy (toChunks) #ifdef EMBED_DATA_FILES -import Text.Pandoc.Data (dataFiles, readmeFile) +import Text.Pandoc.Data (dataFiles) #else import Paths_pandoc (getDataFileName) #endif @@ -743,12 +743,6 @@ inDirectory path action = E.bracket (const $ setCurrentDirectory path >> action) readDefaultDataFile :: FilePath -> IO BS.ByteString -readDefaultDataFile "README" = -#ifdef EMBED_DATA_FILES - return readmeFile -#else - getDataFileName "README" >>= checkExistence >>= BS.readFile -#endif readDefaultDataFile fname = #ifdef EMBED_DATA_FILES case lookup (makeCanonical fname) dataFiles of @@ -760,7 +754,8 @@ readDefaultDataFile fname = go (_:as) ".." = as go as x = x : as #else - getDataFileName ("data" </> fname) >>= checkExistence >>= BS.readFile + getDataFileName fname' >>= checkExistence >>= BS.readFile + where fname' = if fname == "README" then fname else "data" </> fname #endif checkExistence :: FilePath -> IO FilePath |