aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2010-07-08 17:31:55 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2010-07-08 17:31:55 -0700
commitbf43da01c931f1fda936d6357aa3677804d80add (patch)
tree41a29db9c97caa6032807b7df99a86f50487b8ff
parentd67ec663ba65d8001afdc9cf404192ff41108592 (diff)
downloadpandoc-bf43da01c931f1fda936d6357aa3677804d80add.tar.gz
Added writerUserDataDir to WriterOptions.
-rw-r--r--src/Text/Pandoc/Shared.hs2
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs6
-rw-r--r--src/pandoc.hs6
3 files changed, 8 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Shared.hs b/src/Text/Pandoc/Shared.hs
index 63285969a..6cb7a2b95 100644
--- a/src/Text/Pandoc/Shared.hs
+++ b/src/Text/Pandoc/Shared.hs
@@ -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
}
--
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index f7acf8e08..5aa0fd310 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -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
diff --git a/src/pandoc.hs b/src/pandoc.hs
index a1b8244d7..dd2787e7b 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -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" ++