aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/Docx.hs7
-rw-r--r--src/Text/Pandoc/Writers/EPUB.hs10
-rw-r--r--src/Text/Pandoc/Writers/ODT.hs7
-rw-r--r--src/pandoc.hs12
4 files changed, 18 insertions, 18 deletions
diff --git a/src/Text/Pandoc/Writers/Docx.hs b/src/Text/Pandoc/Writers/Docx.hs
index 396e7a482..63329bb44 100644
--- a/src/Text/Pandoc/Writers/Docx.hs
+++ b/src/Text/Pandoc/Writers/Docx.hs
@@ -93,14 +93,13 @@ mknode s attrs =
add_attrs (map (\(k,v) -> Attr (unqual k) v) attrs) . node (unqual s)
-- | Produce an Docx file from a Pandoc document.
-writeDocx :: Maybe FilePath -- ^ Path specified by --reference-docx
- -> WriterOptions -- ^ Writer options
+writeDocx :: WriterOptions -- ^ Writer options
-> Pandoc -- ^ Document to convert
-> IO B.ByteString
-writeDocx mbRefDocx opts doc@(Pandoc (Meta tit auths date) _) = do
+writeDocx opts doc@(Pandoc (Meta tit auths date) _) = do
let datadir = writerUserDataDir opts
refArchive <- liftM toArchive $
- case mbRefDocx of
+ case writerReferenceDocx opts of
Just f -> B.readFile f
Nothing -> do
let defaultDocx = getDataFileName "reference.docx" >>= B.readFile
diff --git a/src/Text/Pandoc/Writers/EPUB.hs b/src/Text/Pandoc/Writers/EPUB.hs
index b423f136f..27356f072 100644
--- a/src/Text/Pandoc/Writers/EPUB.hs
+++ b/src/Text/Pandoc/Writers/EPUB.hs
@@ -52,12 +52,10 @@ import Prelude hiding (catch)
import Control.Exception (catch, SomeException)
-- | Produce an EPUB file from a Pandoc document.
-writeEPUB :: Maybe String -- ^ EPUB stylesheet specified at command line
- -> [FilePath] -- ^ Paths to fonts to embed
- -> WriterOptions -- ^ Writer options
+writeEPUB :: WriterOptions -- ^ Writer options
-> Pandoc -- ^ Document to convert
-> IO B.ByteString
-writeEPUB mbStylesheet fonts opts doc@(Pandoc meta _) = do
+writeEPUB opts doc@(Pandoc meta _) = do
epochtime <- floor `fmap` getPOSIXTime
let mkEntry path content = toEntry path epochtime content
let opts' = opts{ writerEmailObfuscation = NoObfuscation
@@ -107,7 +105,7 @@ writeEPUB mbStylesheet fonts opts doc@(Pandoc meta _) = do
-- handle fonts
let mkFontEntry f = mkEntry (takeFileName f) `fmap` B.readFile f
- fontEntries <- mapM mkFontEntry fonts
+ fontEntries <- mapM mkFontEntry $ writerEpubFonts opts
-- body pages
let isH1 (Header 1 _) = True
@@ -232,7 +230,7 @@ writeEPUB mbStylesheet fonts opts doc@(Pandoc meta _) = do
let appleEntry = mkEntry "META-INF/com.apple.ibooks.display-options.xml" apple
-- stylesheet
- stylesheet <- case mbStylesheet of
+ stylesheet <- case writerEpubStylesheet opts of
Just s -> return s
Nothing -> readDataFile (writerUserDataDir opts) "epub.css"
let stylesheetEntry = mkEntry "stylesheet.css" $ fromString stylesheet
diff --git a/src/Text/Pandoc/Writers/ODT.hs b/src/Text/Pandoc/Writers/ODT.hs
index f8f22494f..b45a6bc92 100644
--- a/src/Text/Pandoc/Writers/ODT.hs
+++ b/src/Text/Pandoc/Writers/ODT.hs
@@ -49,14 +49,13 @@ import Text.Pandoc.XML
import Text.Pandoc.Pretty
-- | Produce an ODT file from a Pandoc document.
-writeODT :: Maybe FilePath -- ^ Path specified by --reference-odt
- -> WriterOptions -- ^ Writer options
+writeODT :: WriterOptions -- ^ Writer options
-> Pandoc -- ^ Document to convert
-> IO B.ByteString
-writeODT mbRefOdt opts doc = do
+writeODT opts doc = do
let datadir = writerUserDataDir opts
refArchive <- liftM toArchive $
- case mbRefOdt of
+ case writerReferenceODT opts of
Just f -> B.readFile f
Nothing -> do
let defaultODT = getDataFileName "reference.odt" >>= B.readFile
diff --git a/src/pandoc.hs b/src/pandoc.hs
index 5cebab28f..fde906eb1 100644
--- a/src/pandoc.hs
+++ b/src/pandoc.hs
@@ -979,7 +979,11 @@ main = do
writerHighlight = highlight,
writerHighlightStyle = highlightStyle,
writerSetextHeaders = setextHeaders,
- writerTeXLigatures = texLigatures
+ writerTeXLigatures = texLigatures,
+ writerEpubStylesheet = epubStylesheet,
+ writerEpubFonts = epubFonts,
+ writerReferenceODT = referenceODT,
+ writerReferenceDocx = referenceDocx
}
when (writerName' `elem` nonTextFormats&& outputFile == "-") $
@@ -1043,12 +1047,12 @@ main = do
writerFn outputFile d
(Nothing, Nothing)
| writerName' == "epub" ->
- writeEPUB epubStylesheet epubFonts writerOptions doc2
+ writeEPUB writerOptions doc2
>>= writeBinary
| writerName' == "odt" ->
- writeODT referenceODT writerOptions doc2 >>= writeBinary
+ writeODT writerOptions doc2 >>= writeBinary
| writerName' == "docx" ->
- writeDocx referenceDocx writerOptions doc2 >>= writeBinary
+ writeDocx writerOptions doc2 >>= writeBinary
| otherwise -> err 9 ("Unknown writer: " ++ writerName')
(Just w, _)
| pdfOutput -> do