aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Text/Pandoc/Writers/ConTeXt.hs6
-rw-r--r--tests/writer.context4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/Text/Pandoc/Writers/ConTeXt.hs b/src/Text/Pandoc/Writers/ConTeXt.hs
index 871748e98..e2e240d33 100644
--- a/src/Text/Pandoc/Writers/ConTeXt.hs
+++ b/src/Text/Pandoc/Writers/ConTeXt.hs
@@ -163,8 +163,10 @@ blockToConTeXt opts HorizontalRule = return $ text "\\thinrule\n"
blockToConTeXt opts (Header level lst) = do
contents <- inlineListToConTeXt opts lst
let base = if writerNumberSections opts then "section" else "subject"
- return $ char '\\' <> text (concat (replicate (level - 1) "sub")) <>
- text base <> char '{' <> contents <> char '}' <> char '\n'
+ return $ if level >= 1 && level <= 5
+ then char '\\' <> text (concat (replicate (level - 1) "sub")) <>
+ text base <> char '{' <> contents <> char '}' <> char '\n'
+ else contents <> char '\n'
blockToConTeXt opts (Table caption aligns widths heads rows) = do
let colWidths = map printDecimal widths
let colDescriptor colWidth alignment = (case alignment of
diff --git a/tests/writer.context b/tests/writer.context
index ae417a051..2d39354a2 100644
--- a/tests/writer.context
+++ b/tests/writer.context
@@ -77,9 +77,9 @@ John Gruber's markdown test suite.
\subsubsubject{Level 3 with {\em emphasis}}
-Level 4
+\subsubsubsubject{Level 4}
-Level 5
+\subsubsubsubsubject{Level 5}
\subject{Level 1}