diff options
author | John MacFarlane <jgm@berkeley.edu> | 2011-01-16 08:59:53 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2011-01-16 08:59:53 -0800 |
commit | ece098b9e06f21c490d4710174bdcd014390b597 (patch) | |
tree | 17a680fab49147d0d39074f9de4880286d52544c /src/Text/Pandoc | |
parent | 9721b87c26861fd9495cd0697fe79c6b1b5e6211 (diff) | |
download | pandoc-ece098b9e06f21c490d4710174bdcd014390b597.tar.gz |
Use <chapter> for top docbook header if template has <book>.
Resolves Issue #265.
Diffstat (limited to 'src/Text/Pandoc')
-rw-r--r-- | src/Text/Pandoc/Writers/Docbook.hs | 8 |
1 files changed, 6 insertions, 2 deletions
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 "</book>" `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) |