Skip to content

Commit

Permalink
tests: rename typst tests and add simplified document
Browse files Browse the repository at this point in the history
Co-authored-by: Andrew Voynov <[email protected]>
  • Loading branch information
grantlemons and Andrew15-5 committed Jan 16, 2025
1 parent 628c2ed commit 7cb7b25
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 2 deletions.
5 changes: 3 additions & 2 deletions harper-typst/tests/run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ macro_rules! create_test {
};
}

create_test!(complex_typst.typ, 0);
create_test!(typst_spelling_mistakes.typ, 4);
create_test!(complex_document.typ, 0);
create_test!(simplified_document.typ, 0);
create_test!(complex_with_spelling_mistakes.typ, 4);
55 changes: 55 additions & 0 deletions harper-typst/tests/test_sources/simplified_document.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#let template(
title: "Default Title",
authors: ("Author 1", "Author 2"),
abstract: [*This is content*],
body,
) = {
set par(justify: true)
set page(
paper: "us-letter",
columns: 2,
number-align: top,
numbering: (..n) => if n.pos().first() > 1 {
n.pos().map(str).join(" of ") + h(1fr) + title
},
)

place(
top + center,
float: true,
scope: "parent",
clearance: 2em,
)[
#show heading: set text(17pt)
= #title

#let authors-line = if authors.len() > 3 {
// "et al." isn't parsed properly, but this isn't the fault of the Typst
// parser.
// authors-max3.push("et al.")
authors => authors.join(", ")
} else {
authors => authors.join(", ", last: ", and ")
}
#emph(authors-line(authors.slice(0, calc.min(authors.len(), 3))))

#par(justify: false)[
*Abstract* \
#abstract
]
]

body
}

#show: template.with(
title: "A fluid dynamic model for glacier flow",
authors: ("Grant Lemons", "John Doe", "Jane Doe"),
abstract: lorem(80),
)

= Introduction
#lorem(300)

= Related Work
#lorem(200)

0 comments on commit 7cb7b25

Please sign in to comment.