diff options
author | John MacFarlane <jgm@berkeley.edu> | 2016-11-30 15:34:58 +0100 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2016-11-30 15:34:58 +0100 |
commit | fb8a2540bdb91eee0ecf620b4e9d7acf3d78042f (patch) | |
tree | 448a3c909200e8bbd45ecaa65f2f85d88bcc66c6 /src/Text/Pandoc/Writers/Docbook.hs | |
parent | ac312caabd8c4e595e0b930154fd3033ba397ace (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 'src/Text/Pandoc/Writers/Docbook.hs')
-rw-r--r-- | src/Text/Pandoc/Writers/Docbook.hs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs index 278bbdcc8..5321d46df 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/src/Text/Pandoc/Writers/Docbook.hs @@ -80,7 +80,8 @@ writeDocbook opts (Pandoc meta blocks) = then Just $ writerColumns opts else Nothing render' = render colwidth - opts' = if ("/book>" `isSuffixOf` (trimr $ writerTemplate opts) && + opts' = if (maybe False (("/book>" `isSuffixOf`) . trimr) + (writerTemplate opts) && TopLevelDefault == writerTopLevelDivision opts) then opts{ writerTopLevelDivision = TopLevelChapter } else opts @@ -103,9 +104,9 @@ writeDocbook opts (Pandoc meta blocks) = MathML _ -> True _ -> False) $ metadata - in if writerStandalone opts - then renderTemplate' (writerTemplate opts) context - else main + in case writerTemplate opts of + Nothing -> main + Just tpl -> renderTemplate' tpl context -- | Convert an Element to Docbook. elementToDocbook :: WriterOptions -> Int -> Element -> Doc |