Skip to content

Commit f037eb2

Browse files
committed
pagebreak: add support for ConTeXt
1 parent 0f11ff1 commit f037eb2

File tree

2 files changed

+14
-10
lines changed

2 files changed

+14
-10
lines changed

pagebreak/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ Usage
1919

2020
Fully supported output formats are:
2121

22-
- AsciiDoc / Asciidoctor
22+
- AsciiDoc / Asciidoctor,
23+
- ConTeXt,
2324
- Docx,
2425
- EPUB,
2526
- groff ms,

pagebreak/pagebreak.lua

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ end
2424
--- configs – these are populated in the Meta filter.
2525
local pagebreak = {
2626
asciidoc = '<<<\n\n',
27+
context = '\\page',
2728
epub = '<p style="page-break-after: always;"> </p>',
2829
html = '<div style="page-break-after: always;"></div>',
2930
latex = '\\newpage{}',
@@ -50,20 +51,22 @@ end
5051

5152
--- Return a block element causing a page break in the given format.
5253
local function newpage(format)
53-
if format == 'docx' then
54+
if format:match 'asciidoc' then
55+
return pandoc.RawBlock('asciidoc', pagebreak.asciidoc)
56+
elseif format == 'context' then
57+
return pandoc.RawBlock('context', pagebreak.context)
58+
elseif format == 'docx' then
5459
return pandoc.RawBlock('openxml', pagebreak.ooxml)
55-
elseif format:match 'latex' then
56-
return pandoc.RawBlock('tex', pagebreak.latex)
57-
elseif format:match 'odt' then
58-
return pandoc.RawBlock('opendocument', pagebreak.odt)
59-
elseif format:match 'html.*' then
60-
return pandoc.RawBlock('html', pagebreak.html)
6160
elseif format:match 'epub' then
6261
return pandoc.RawBlock('html', pagebreak.epub)
62+
elseif format:match 'html.*' then
63+
return pandoc.RawBlock('html', pagebreak.html)
64+
elseif format:match 'latex' then
65+
return pandoc.RawBlock('tex', pagebreak.latex)
6366
elseif format:match 'ms' then
6467
return pandoc.RawBlock('ms', pagebreak.ms)
65-
elseif format:match 'asciidoc' then
66-
return pandoc.RawBlock('asciidoc', pagebreak.asciidoc)
68+
elseif format:match 'odt' then
69+
return pandoc.RawBlock('opendocument', pagebreak.odt)
6770
else
6871
-- fall back to insert a form feed character
6972
return pandoc.Para{pandoc.Str '\f'}

0 commit comments

Comments
 (0)