summaryrefslogtreecommitdiff
path: root/pandoc.hs
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2016-11-30 15:34:58 +0100
committerJohn MacFarlane <jgm@berkeley.edu>2016-11-30 15:34:58 +0100
commitfb8a2540bdb91eee0ecf620b4e9d7acf3d78042f (patch)
tree448a3c909200e8bbd45ecaa65f2f85d88bcc66c6 /pandoc.hs
parentac312caabd8c4e595e0b930154fd3033ba397ace (diff)
Options: Removed writerStandalone, made writerTemplate a Maybe.
Previously setting writerStandalone = True did nothing unless a template was provided in writerTemplate. Now a fragment will be generated if writerTemplate is Nothing; otherwise, the specified template will be used and standalone output generated. [API change]
Diffstat (limited to 'pandoc.hs')
-rw-r--r--pandoc.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/pandoc.hs b/pandoc.hs
index d426e59e2..0c2bcec5d 100644
--- a/pandoc.hs
+++ b/pandoc.hs
@@ -1292,18 +1292,18 @@ convertWithOpts opts args = do
let standalone' = standalone || not (isTextFormat format) || pdfOutput
templ <- case templatePath of
- _ | not standalone' -> return ""
+ _ | not standalone' -> return Nothing
Nothing -> do
deftemp <- getDefaultTemplate datadir format
case deftemp of
Left e -> throwIO e
- Right t -> return t
+ Right t -> return (Just t)
Just tp -> do
-- strip off extensions
let tp' = case takeExtension tp of
"" -> tp <.> format
_ -> tp
- E.catch (UTF8.readFile tp')
+ Just <$> E.catch (UTF8.readFile tp')
(\e -> if isDoesNotExistError e
then E.catch
(readDataFileUTF8 datadir
@@ -1416,8 +1416,7 @@ convertWithOpts opts args = do
_ -> do pairs <- mapM (\s -> sourceToDoc [s]) sources
return (mconcat $ map fst pairs, mconcat $ map snd pairs)
- let writerOptions = def { writerStandalone = standalone',
- writerTemplate = templ,
+ let writerOptions = def { writerTemplate = templ,
writerVariables = variables'',
writerTabStop = tabStop,
writerTableOfContents = toc,