Added writerUserDataDir to WriterOptions.
This commit is contained in:
parent
d67ec663ba
commit
bf43da01c9
3 changed files with 8 additions and 6 deletions
|
@ -478,6 +478,7 @@ data WriterOptions = WriterOptions
|
|||
, writerEmailObfuscation :: ObfuscationMethod -- ^ How to obfuscate emails
|
||||
, writerIdentifierPrefix :: String -- ^ Prefix for section & note ids in HTML
|
||||
, writerSourceDirectory :: FilePath -- ^ Directory path of 1st source file
|
||||
, writerUserDataDir :: Maybe FilePath -- ^ Path of user data directory
|
||||
} deriving Show
|
||||
|
||||
-- | Default writer options.
|
||||
|
@ -502,6 +503,7 @@ defaultWriterOptions =
|
|||
, writerEmailObfuscation = JavascriptObfuscation
|
||||
, writerIdentifierPrefix = ""
|
||||
, writerSourceDirectory = "."
|
||||
, writerUserDataDir = Nothing
|
||||
}
|
||||
|
||||
--
|
||||
|
|
|
@ -42,12 +42,12 @@ import System.Directory
|
|||
import Control.Monad (liftM)
|
||||
|
||||
-- | Produce an ODT file from a Pandoc document.
|
||||
writeODT :: Maybe FilePath -- ^ Path of user data directory
|
||||
-> Maybe FilePath -- ^ Path specified by --reference-odt
|
||||
writeODT :: Maybe FilePath -- ^ Path specified by --reference-odt
|
||||
-> WriterOptions -- ^ Writer options
|
||||
-> Pandoc -- ^ Document to convert
|
||||
-> IO B.ByteString
|
||||
writeODT datadir mbRefOdt opts doc = do
|
||||
writeODT mbRefOdt opts doc = do
|
||||
let datadir = writerUserDataDir opts
|
||||
refArchive <- liftM toArchive $
|
||||
case mbRefOdt of
|
||||
Just f -> B.readFile f
|
||||
|
|
|
@ -701,8 +701,7 @@ main = do
|
|||
Just s -> return s
|
||||
Nothing -> readDataFile datadir "epub.css"
|
||||
return (writeEPUB epubstyle)
|
||||
Just _ | writerName' == "odt" -> return
|
||||
(writeODT datadir referenceODT)
|
||||
Just _ | writerName' == "odt" -> return (writeODT referenceODT)
|
||||
Just r -> return $ \o d ->
|
||||
return $ fromString (r o d)
|
||||
Nothing -> error ("Unknown writer: " ++ writerName')
|
||||
|
@ -782,7 +781,8 @@ main = do
|
|||
then ReferenceObfuscation
|
||||
else obfuscationMethod,
|
||||
writerIdentifierPrefix = idPrefix,
|
||||
writerSourceDirectory = sourceDir }
|
||||
writerSourceDirectory = sourceDir,
|
||||
writerUserDataDir = datadir }
|
||||
|
||||
when (isNonTextOutput writerName' && outputFile == "-") $
|
||||
do UTF8.hPutStrLn stderr ("Error: Cannot write " ++ writerName ++ " output to stdout.\n" ++
|
||||
|
|
Loading…
Reference in a new issue