aboutsummaryrefslogtreecommitdiff
path: root/test/Tests
diff options
context:
space:
mode:
authorHenri Menke <henri@icp.uni-stuttgart.de>2018-01-26 08:56:28 +1300
committerJohn MacFarlane <jgm@berkeley.edu>2018-01-25 11:56:28 -0800
commit751b5ad010794ec51699bfb89de91b38c85d3297 (patch)
treed2652bb932bcae8da846dc14f0730a3c0d0b853d /test/Tests
parent0d7aedca58742f9c353010d9877ef666ee4c7af0 (diff)
downloadpandoc-751b5ad010794ec51699bfb89de91b38c85d3297.tar.gz
ConTeXt writer: new section syntax and --section-divs (#4295)
Fixes #2609. This PR introduces the new-style section headings: `\section[my-header]{My Header}` -> `\section[title={My Header},reference={my-header}]`. On top of this, the ConTeXt writer now supports the `--section-divs` option to write sections in the fenced style, with `\startsection` and `\stopsection`.
Diffstat (limited to 'test/Tests')
-rw-r--r--test/Tests/Writers/ConTeXt.hs25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/Tests/Writers/ConTeXt.hs b/test/Tests/Writers/ConTeXt.hs
index 678321519..812aab4a6 100644
--- a/test/Tests/Writers/ConTeXt.hs
+++ b/test/Tests/Writers/ConTeXt.hs
@@ -18,6 +18,9 @@ context' = unpack . purely (writeConTeXt def{ writerWrapText = WrapNone }) . toP
contextNtb :: (ToPandoc a) => a -> String
contextNtb = unpack . purely (writeConTeXt def{ writerExtensions = enableExtension Ext_ntb pandocExtensions }) . toPandoc
+contextDiv :: (ToPandoc a) => a -> String
+contextDiv = unpack . purely (writeConTeXt def{ writerSectionDivs = True }) . toPandoc
+
{-
"my test" =: X =?> Y
@@ -47,7 +50,27 @@ tests = [ testGroup "inline code"
]
, testGroup "headers"
[ "level 1" =:
- headerWith ("my-header",[],[]) 1 "My header" =?> "\\section[my-header]{My header}"
+ headerWith ("my-header",[],[]) 1 "My header" =?> "\\section[title={My header},reference={my-header}]"
+ , test contextDiv "section-divs" $
+ ( headerWith ("header1", [], []) 1 (text "Header1")
+ <> headerWith ("header2", [], []) 2 (text "Header2")
+ <> headerWith ("header3", [], []) 3 (text "Header3")
+ <> headerWith ("header4", [], []) 4 (text "Header4")
+ <> headerWith ("header5", [], []) 5 (text "Header5")
+ <> headerWith ("header6", [], []) 6 (text "Header6"))
+ =?>
+ unlines [ "\\startsection[title={Header1},reference={header1}]\n"
+ , "\\startsubsection[title={Header2},reference={header2}]\n"
+ , "\\startsubsubsection[title={Header3},reference={header3}]\n"
+ , "\\startsubsubsubsection[title={Header4},reference={header4}]\n"
+ , "\\startsubsubsubsubsection[title={Header5},reference={header5}]\n"
+ , "\\startsubsubsubsubsubsection[title={Header6},reference={header6}]\n"
+ , "\\stopsubsubsubsubsubsection\n"
+ , "\\stopsubsubsubsubsection\n"
+ , "\\stopsubsubsubsection\n"
+ , "\\stopsubsubsection\n"
+ , "\\stopsubsection\n"
+ , "\\stopsection" ]
]
, testGroup "bullet lists"
[ "nested" =: