diff --git a/test/asciidoc.md b/test/asciidoc.md new file mode 100644 index 0000000..47ee1bc --- /dev/null +++ b/test/asciidoc.md @@ -0,0 +1,21 @@ +## Asciidoc + +``` markdown {#input} +Before the page break. + +\newpage + +First line on a new page. +``` + +Asciidoc uses three *smaller-than* characters to mark a page +break. + +``` asciidoc {#expected format="asciidoc"} +Before the page break. + +<<< + +First line on a new page. + +``` diff --git a/test/expected.adoc b/test/expected.adoc deleted file mode 100644 index cf17420..0000000 --- a/test/expected.adoc +++ /dev/null @@ -1,22 +0,0 @@ -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec -hendrerit tempor tellus. Donec pretium posuere tellus. - -<<< - -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur -ridiculus mus. Nulla posuere. Donec vitae dolor. - -<<< - -Pellentesque dapibus suscipit ligula. Donec posuere augue in quam. -Suspendisse potenti. - -The following does not mark a pagebreak unless the interpretation of -LaTeX commands in plain paragraphs is enabled. - -<<< - -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur -ridiculus mus. - -Final paragraph without a preceding pagebreak. diff --git a/test/expected.html b/test/expected.html deleted file mode 100644 index aecfd1b..0000000 --- a/test/expected.html +++ /dev/null @@ -1,9 +0,0 @@ -

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec hendrerit tempor tellus. Donec pretium posuere tellus.

-
-

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla posuere. Donec vitae dolor.

-
-

Pellentesque dapibus suscipit ligula. Donec posuere augue in quam. Suspendisse potenti.

-

The following does not mark a pagebreak unless the interpretation of LaTeX commands in plain paragraphs is enabled.

-

\pagebreak

-

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

-

Final paragraph without a preceding pagebreak.

diff --git a/test/expected.ms b/test/expected.ms deleted file mode 100644 index 16bf638..0000000 --- a/test/expected.ms +++ /dev/null @@ -1,25 +0,0 @@ -.LP -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. -Donec hendrerit tempor tellus. -Donec pretium posuere tellus. -.bp -.PP -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur -ridiculus mus. -Nulla posuere. -Donec vitae dolor. -.bp -.PP -Pellentesque dapibus suscipit ligula. -Donec posuere augue in quam. -Suspendisse potenti. -.PP -The following does not mark a pagebreak unless the interpretation of -LaTeX commands in plain paragraphs is enabled. -.PP -\[rs]pagebreak -.PP -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur -ridiculus mus. -.PP -Final paragraph without a preceding pagebreak. diff --git a/test/expected.no-form-feed.html b/test/expected.no-form-feed.html deleted file mode 100644 index deaf2ad..0000000 --- a/test/expected.no-form-feed.html +++ /dev/null @@ -1,9 +0,0 @@ -

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec hendrerit tempor tellus. Donec pretium posuere tellus.

-
-

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Nulla posuere. Donec vitae dolor.

-

-

Pellentesque dapibus suscipit ligula. Donec posuere augue in quam. Suspendisse potenti.

-

The following does not mark a pagebreak unless the interpretation of LaTeX commands in plain paragraphs is enabled.

-

\pagebreak

-

Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.

-

Final paragraph without a preceding pagebreak.

diff --git a/test/expected.typst b/test/expected.typst deleted file mode 100644 index f37fb59..0000000 --- a/test/expected.typst +++ /dev/null @@ -1,22 +0,0 @@ -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec -hendrerit tempor tellus. Donec pretium posuere tellus. - -#pagebreak() - -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur -ridiculus mus. Nulla posuere. Donec vitae dolor. - -#pagebreak() - -Pellentesque dapibus suscipit ligula. Donec posuere augue in quam. -Suspendisse potenti. - -The following does not mark a pagebreak unless the interpretation of -LaTeX commands in plain paragraphs is enabled. - -\\pagebreak - -Cum sociis natoque penatibus et magnis dis parturient montes, nascetur -ridiculus mus. - -Final paragraph without a preceding pagebreak. diff --git a/test/form-feed.md b/test/form-feed.md new file mode 100644 index 0000000..3543a58 --- /dev/null +++ b/test/form-feed.md @@ -0,0 +1,28 @@ +# Form Feed + +Form feed characters can be used in place of the `\newpage` +command if the respective option is enabled: + +``` markdown {#input} +--- +pagebreak: + break-on: + form-feed: true +--- + +Before the page break. + + + +First line on a new page. +``` + +It becomes a `\newpage` command in LaTeX output. + +``` latex {#expected} +Before the page break. + +\newpage{} + +First line on a new page. +``` diff --git a/test/html.md b/test/html.md new file mode 100644 index 0000000..7e980ed --- /dev/null +++ b/test/html.md @@ -0,0 +1,18 @@ +## HTML + +``` markdown {#input} +Before the page break. + +\newpage + +First line on a new page. +``` + +Asciidoc uses three *smaller-than* characters to mark a page +break. + +``` html {#expected} +

Before the page break.

+
+

First line on a new page.

+``` diff --git a/test/input.md b/test/input.md deleted file mode 100644 index a2cf536..0000000 --- a/test/input.md +++ /dev/null @@ -1,22 +0,0 @@ -Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec -hendrerit tempor tellus. Donec pretium posuere tellus. - -\newpage - -Cum sociis natoque penatibus et magnis dis parturient montes, -nascetur ridiculus mus. Nulla posuere. Donec vitae dolor. - - - -Pellentesque dapibus suscipit ligula. Donec posuere augue in -quam. Suspendisse potenti. - -The following does not mark a pagebreak unless the interpretation -of LaTeX commands in plain paragraphs is enabled. - -\\pagebreak - -Cum sociis natoque penatibus et magnis dis parturient montes, -nascetur ridiculus mus. - -Final paragraph without a preceding pagebreak. diff --git a/test/ms.md b/test/ms.md new file mode 100644 index 0000000..34a3ea7 --- /dev/null +++ b/test/ms.md @@ -0,0 +1,19 @@ +## MS + +``` markdown {#input} +Before the page break. + +\newpage + +First line on a new page. +``` + +A page break is simply the `.bp` macro in MS: + +``` ms {#expected} +.LP +Before the page break. +.bp +.PP +First line on a new page. +``` diff --git a/test/perevir.yaml b/test/perevir.yaml new file mode 100644 index 0000000..ff5e9ab --- /dev/null +++ b/test/perevir.yaml @@ -0,0 +1,5 @@ +--- +filters: + - pagebreak.lua +compare: strings +--- diff --git a/test/plaintext-command.md b/test/plaintext-command.md new file mode 100644 index 0000000..3ba6eeb --- /dev/null +++ b/test/plaintext-command.md @@ -0,0 +1,35 @@ +# Plaintext LaTeX Command + +When reading from a formats that doesn't support raw LaTeX +snippets, the `plaintext-command` option must be enabled in order +for the `\newpage` command being recognized as a page break +marker. + +``` markdown {#input} +--- +pagebreak: + break-on: + plaintext-command: true +--- + +Before the page break. + +\\newpage + +First line on a new page. +``` + +Note that pandoc does not parse above as raw LaTeX due to the +double-backslash, but the `plaintext-command` option ensures that +the filter still recognizes it as a page break. + +``` latex {#expected} +Before the page break. + +\newpage{} + +First line on a new page. +``` + +Note that this option comes at the cost of slightly decreased +performance. diff --git a/test/test-adoc.yaml b/test/test-adoc.yaml deleted file mode 100644 index 41b4e49..0000000 --- a/test/test-adoc.yaml +++ /dev/null @@ -1,10 +0,0 @@ -input-files: [test/input.md] -to: asciidoc -filters: - - pagebreak.lua - -metadata: - pagebreak: - break-on: - form-feed: true - plaintext-command: true diff --git a/test/test-html.yaml b/test/test-html.yaml deleted file mode 100644 index cd35383..0000000 --- a/test/test-html.yaml +++ /dev/null @@ -1,10 +0,0 @@ -input-files: [test/input.md] -to: html5 -wrap: none -filters: - - pagebreak.lua - -metadata: - pagebreak: - break-on: - form-feed: true diff --git a/test/test-ms.yaml b/test/test-ms.yaml deleted file mode 100644 index ff8f11a..0000000 --- a/test/test-ms.yaml +++ /dev/null @@ -1,9 +0,0 @@ -input-files: [test/input.md] -to: ms -filters: - - pagebreak.lua - -metadata: - pagebreak: - break-on: - form-feed: true diff --git a/test/test-no-form-feed.html.yaml b/test/test-no-form-feed.html.yaml deleted file mode 100644 index e548054..0000000 --- a/test/test-no-form-feed.html.yaml +++ /dev/null @@ -1,5 +0,0 @@ -input-files: [test/input.md] -to: html5 -wrap: none -filters: - - pagebreak.lua diff --git a/test/test-typst.yaml b/test/test-typst.yaml deleted file mode 100644 index 860d47d..0000000 --- a/test/test-typst.yaml +++ /dev/null @@ -1,9 +0,0 @@ -input-files: [test/input.md] -to: typst -filters: - - pagebreak.lua - -metadata: - pagebreak: - break-on: - form-feed: true diff --git a/test/typst.md b/test/typst.md new file mode 100644 index 0000000..4b02c3a --- /dev/null +++ b/test/typst.md @@ -0,0 +1,20 @@ +## Typst + +``` markdown {#input} +Before the page break. + +\newpage + +First line on a new page. +``` + +The `#pagebreak()` command is used for Typst. + +``` typst {#expected} +Before the page break. + +#pagebreak() + +First line on a new page. + +```