Skip to content

Commit

Permalink
Switch to perevir for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Aug 16, 2024
1 parent b3e32d9 commit 8ddb08d
Show file tree
Hide file tree
Showing 18 changed files with 146 additions and 152 deletions.
21 changes: 21 additions & 0 deletions test/asciidoc.md
Original file line number Diff line number Diff line change
@@ -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.

```
22 changes: 0 additions & 22 deletions test/expected.adoc

This file was deleted.

9 changes: 0 additions & 9 deletions test/expected.html

This file was deleted.

25 changes: 0 additions & 25 deletions test/expected.ms

This file was deleted.

9 changes: 0 additions & 9 deletions test/expected.no-form-feed.html

This file was deleted.

22 changes: 0 additions & 22 deletions test/expected.typst

This file was deleted.

28 changes: 28 additions & 0 deletions test/form-feed.md
Original file line number Diff line number Diff line change
@@ -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.
```
18 changes: 18 additions & 0 deletions test/html.md
Original file line number Diff line number Diff line change
@@ -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}
<p>Before the page break.</p>
<div style="page-break-after: always;"></div>
<p>First line on a new page.</p>
```
22 changes: 0 additions & 22 deletions test/input.md

This file was deleted.

19 changes: 19 additions & 0 deletions test/ms.md
Original file line number Diff line number Diff line change
@@ -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.
```
5 changes: 5 additions & 0 deletions test/perevir.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
filters:
- pagebreak.lua
compare: strings
---
35 changes: 35 additions & 0 deletions test/plaintext-command.md
Original file line number Diff line number Diff line change
@@ -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.
10 changes: 0 additions & 10 deletions test/test-adoc.yaml

This file was deleted.

10 changes: 0 additions & 10 deletions test/test-html.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions test/test-ms.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions test/test-no-form-feed.html.yaml

This file was deleted.

9 changes: 0 additions & 9 deletions test/test-typst.yaml

This file was deleted.

20 changes: 20 additions & 0 deletions test/typst.md
Original file line number Diff line number Diff line change
@@ -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.
```

0 comments on commit 8ddb08d

Please sign in to comment.