aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-10-11 20:21:55 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2017-10-11 20:21:55 -0700
commit75d8c99c73d2a725c6753170050fa77469c803d1 (patch)
treeab5a48d859391b132b01052c63e8cfa396a13a1c /src
parent71e4543cc042240be2835b9c76f7dbb7158d1049 (diff)
downloadpandoc-75d8c99c73d2a725c6753170050fa77469c803d1.tar.gz
ConTeXt writer: Use identifiers for chapters.
Closes #3968.
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 6f2cb2b9e..0a399197d 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -449,19 +449,20 @@ sectionHeader (ident,classes,_) hdrLevel lst = do
TopLevelChapter -> hdrLevel - 1
TopLevelSection -> hdrLevel
TopLevelDefault -> hdrLevel
- let ident' = toLabel ident
+ let ident' = if null ident
+ then empty
+ else brackets (text (toLabel ident))
let (section, chapter) = if "unnumbered" `elem` classes
then (text "subject", text "title")
else (text "section", text "chapter")
return $ case level' of
- -1 -> text "\\part" <> braces contents
- 0 -> char '\\' <> chapter <> braces contents
+ -1 -> text "\\part" <> ident' <> braces contents
+ 0 -> char '\\' <> chapter <> ident' <>
+ braces contents
n | n >= 1 && n <= 5 -> char '\\'
<> text (concat (replicate (n - 1) "sub"))
<> section
- <> (if (not . null) ident'
- then brackets (text ident')
- else empty)
+ <> ident'
<> braces contents
<> blankline
_ -> contents <> blankline