aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2011-01-16 09:08:19 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2011-01-16 09:08:19 -0800
commitab20da4be50c31a4c31574f73c74367aaea150f3 (patch)
tree57afd2a81d1ed4ba0976721181574c38d57c5919 /src
parentece098b9e06f21c490d4710174bdcd014390b597 (diff)
downloadpandoc-ab20da4be50c31a4c31574f73c74367aaea150f3.tar.gz
Support --chapters for ConTeXt output as well.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 8e0387a84..b693bf7fa 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -169,10 +169,13 @@ blockToConTeXt (Header level lst) = do
st <- get
let opts = stOptions st
let base = if writerNumberSections opts then "section" else "subject"
- return $ if level >= 1 && level <= 5
- then char '\\' <> text (concat (replicate (level - 1) "sub")) <>
+ let level' = if writerChapters opts then level - 1 else level
+ return $ if level' >= 1 && level' <= 5
+ then char '\\' <> text (concat (replicate (level' - 1) "sub")) <>
text base <> char '{' <> contents <> char '}' <> blankline
- else contents <> blankline
+ else if level' == 0
+ then "\\chapter{" <> contents <> "}"
+ else contents <> blankline
blockToConTeXt (Table caption aligns widths heads rows) = do
let colDescriptor colWidth alignment = (case alignment of
AlignLeft -> 'l'