From ece098b9e06f21c490d4710174bdcd014390b597 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 16 Jan 2011 08:59:53 -0800 Subject: Use for top docbook header if template has . Resolves Issue #265. --- src/Text/Pandoc/Writers/Docbook.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/Text/Pandoc/Writers/Docbook.hs b/src/Text/Pandoc/Writers/Docbook.hs index 2706f3334..d0fb2c541 100644 --- a/src/Text/Pandoc/Writers/Docbook.hs +++ b/src/Text/Pandoc/Writers/Docbook.hs @@ -33,7 +33,7 @@ import Text.Pandoc.XML import Text.Pandoc.Shared import Text.Pandoc.Templates (renderTemplate) import Text.Pandoc.Readers.TeXMath -import Data.List ( isPrefixOf, intercalate ) +import Data.List ( isPrefixOf, intercalate, isSuffixOf ) import Data.Char ( toLower ) import Text.Pandoc.Highlighting (languages, languagesByExtension) import Text.Pandoc.Pretty @@ -69,7 +69,11 @@ writeDocbook opts (Pandoc (Meta tit auths dat) blocks) = then Just $ writerColumns opts else Nothing render' = render colwidth - main = render' $ vcat (map (elementToDocbook opts) elements) + opts' = if "" `isSuffixOf` + (removeTrailingSpace $ writerTemplate opts) + then opts{ writerChapters = True } + else opts + main = render' $ vcat (map (elementToDocbook opts') elements) context = writerVariables opts ++ [ ("body", main) , ("title", render' title) -- cgit v1.2.3