ConTeXt writer: Made --toc work even without --number-sections.

This commit is contained in:
John MacFarlane 2011-12-30 11:42:05 -08:00
parent c5c7aa653a
commit edf646a90d
2 changed files with 3 additions and 3 deletions

View file

@ -76,6 +76,7 @@ pandocToConTeXt options (Pandoc (Meta title authors date) blocks) = do
, ("body", main)
, ("title", titletext)
, ("date", datetext) ] ++
[ ("number-sections", "yes") | writerNumberSections options ] ++
[ ("author", a) | a <- authorstext ]
return $ if writerStandalone options
then renderTemplate context $ writerTemplate options
@ -175,11 +176,10 @@ blockToConTeXt (Header level lst) = do
contents <- inlineListToConTeXt lst
st <- get
let opts = stOptions st
let base = if writerNumberSections opts then "section" else "subject"
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
text "section" <> char '{' <> contents <> char '}' <> blankline
else if level' == 0
then "\\chapter{" <> contents <> "}"
else contents <> blankline

@ -1 +1 @@
Subproject commit 88ec0260641e994069fa1b2c1912306c515420f8
Subproject commit 5dcdf3738f0469143bb61ec9b89e9b34a21e2194