diff options
| author | John MacFarlane <[email protected]> | 2020-04-17 17:28:55 -0700 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2020-04-17 22:55:44 -0700 |
| commit | 3eb9e1b8bd6eec9b96ab1da230b90d635970607e (patch) | |
| tree | dab56cee01110319f9f981c55aeb9e0f9993cac0 /src/Text/Pandoc/App/CommandLineOptions.hs | |
| parent | 8f40b4ba14fce10199a059a281c9bd10c884241d (diff) | |
Fooling around with a new setup for Text.Pandoc.Data.initialize-data-files
It is Now an exported module, exporting initializeDataFiles which must
be run in PandocMonad if you are going to be looking for any data files.
The point of this is to decouple pandoc's data from "pandoc-core,"
including the infrastructure for PandocMonad.
Diffstat (limited to 'src/Text/Pandoc/App/CommandLineOptions.hs')
| -rw-r--r-- | src/Text/Pandoc/App/CommandLineOptions.hs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/Text/Pandoc/App/CommandLineOptions.hs b/src/Text/Pandoc/App/CommandLineOptions.hs index c3b05b70f..c8ff55516 100644 --- a/src/Text/Pandoc/App/CommandLineOptions.hs +++ b/src/Text/Pandoc/App/CommandLineOptions.hs @@ -52,7 +52,7 @@ import Text.Pandoc.Shared (ordNub, elemText, safeStrRead, defaultUserDataDirs, f import Text.Printf #ifdef EMBED_DATA_FILES -import Text.Pandoc.Data (dataFiles) +import Text.Pandoc.Data (initializeDataFiles) #else import Paths_pandoc (getDataDir) import System.Directory (getDirectoryContents) @@ -760,7 +760,8 @@ options = (NoArg (\_ -> do datafiles <- getDataFileNames - tpl <- runIOorExplode $ + tpl <- runIOorExplode $ do + initializeDataFiles UTF8.toString <$> readDefaultDataFile "bash_completion.tpl" let optnames (Option shorts longs _ _) = @@ -841,6 +842,7 @@ options = Just f -> UTF8.writeFile f Nothing -> UTF8.hPutStr stdout templ <- runIO $ do + initializeDataFiles setUserDataDir Nothing getDefaultTemplate (T.pack arg) case templ of @@ -916,7 +918,9 @@ options = getDataFileNames :: IO [FilePath] getDataFileNames = do #ifdef EMBED_DATA_FILES - let allDataFiles = map fst dataFiles + allDataFiles <- runIOorExplode $ do + initializeDataFiles + map fst . stDataFiles <$> getCommonState #else allDataFiles <- filter (\x -> x /= "." && x /= "..") <$> (getDataDir >>= getDirectoryContents) |
