diff options
author | John MacFarlane <jgm@berkeley.edu> | 2010-07-08 17:14:03 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2010-07-08 17:16:30 -0700 |
commit | d67ec663ba65d8001afdc9cf404192ff41108592 (patch) | |
tree | e18d07996ca2adeca626d377b895d8e2510dacd2 /src/pandoc.hs | |
parent | 84178204983aeff0cf8c260316db8cb7db271e11 (diff) | |
download | pandoc-d67ec663ba65d8001afdc9cf404192ff41108592.tar.gz |
Added writerSourceDirectory to WriterOptions.
This allows us to remove an argument from the ODT and EPUB
writers.
Diffstat (limited to 'src/pandoc.hs')
-rw-r--r-- | src/pandoc.hs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/pandoc.hs b/src/pandoc.hs index 36c6b2cda..a1b8244d7 100644 --- a/src/pandoc.hs +++ b/src/pandoc.hs @@ -672,10 +672,6 @@ main = do Nothing -> return () let sources = if ignoreArgs then [] else args - - let sourceDirRelative = if null sources - then "" - else takeDirectory (head sources) datadir <- case mbDataDir of Nothing -> catch @@ -704,9 +700,9 @@ main = do epubstyle <- case epubStylesheet of Just s -> return s Nothing -> readDataFile datadir "epub.css" - return (writeEPUB sourceDirRelative epubstyle) + return (writeEPUB epubstyle) Just _ | writerName' == "odt" -> return - (writeODT datadir sourceDirRelative referenceODT) + (writeODT datadir referenceODT) Just r -> return $ \o d -> return $ fromString (r o d) Nothing -> error ("Unknown writer: " ++ writerName') @@ -742,6 +738,10 @@ main = do return $ ("mathml-script", s) : variables' _ -> return variables' + let sourceDir = if null sources + then "." + else takeDirectory (head sources) + let startParserState = defaultParserState { stateParseRaw = parseRaw, stateTabStop = tabStop, @@ -757,6 +757,7 @@ main = do stateColumns = columns, stateStrict = strict, stateIndentedCodeClasses = codeBlockClasses } + let writerOptions = WriterOptions { writerStandalone = standalone', writerTemplate = if null template then defaultTemplate @@ -780,7 +781,8 @@ main = do writerEmailObfuscation = if strict then ReferenceObfuscation else obfuscationMethod, - writerIdentifierPrefix = idPrefix } + writerIdentifierPrefix = idPrefix, + writerSourceDirectory = sourceDir } when (isNonTextOutput writerName' && outputFile == "-") $ do UTF8.hPutStrLn stderr ("Error: Cannot write " ++ writerName ++ " output to stdout.\n" ++ |