Skip to content

Commit

Permalink
tests(Automattic#230): add document with spelling mistakes in differe…
Browse files Browse the repository at this point in the history
…nt contexts
  • Loading branch information
grantlemons committed Dec 30, 2024
1 parent 00623b0 commit 122436f
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 3 deletions.
1 change: 1 addition & 0 deletions harper-core/tests/run_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,4 @@ create_test!(chinese_lorem_ipsum.md, 2);
create_test!(obsidian_links.md, 2);
create_test!(issue_267.md, 0);
create_test!(complex_typst.typ, 0);
create_test!(typst_spelling_mistakes.typ, 4);
5 changes: 2 additions & 3 deletions harper-core/tests/test_sources/complex_typst.typ
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@
#let count = authors.len()
#let authors_slice = authors.slice(0, calc.min(count, 3))
_#if count > 3 {
// Disabled because et al. isn't parsed properly, but this isn't the
// fault of the typst parser
//
// et al. isn't parsed properly, but this isn't the fault of the typst
// parser
// authors_slice.push("et al.")
authors_slice.join(", ")
} else {
Expand Down
63 changes: 63 additions & 0 deletions harper-core/tests/test_sources/typst_spelling_mistakes.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#set page(
paper: "us-letter",
columns: 2,
)

#let titleblock(
title: "Defalt Title",
authors: ("Author 1", "Author 2"),
abstract: [*This is contnt*],
) = {
set page(
header: context {
if counter(page).get().first() > 1 [
#counter(page).get().first() of #counter(page).final().at(0)
#h(1fr)
#title
]
},
)
place(
top + center,
float: true,
scope: "parent",
clearance: 2em,
)[
#align(center, text(17pt)[
*#title*
])

#let authors = authors.filter(x => x.len() > 0)
#let count = authors.len()
#let authors_slice = authors.slice(0, calc.min(count, 3))
_#if count > 3 {
// et al. isn't parsed properly, but this isn't the fault of the typst
// parser
// authors_slice.push("et al.")
authors_slice.join(", ")
} else {
authors_slice.join(", ", last: ", and ")
}
_

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

#show: doc => [
#titleblock(
title: "A fluid dynamic model for glaier flow",
authors: ("Grant Lemons", "John Doe", "Jane Doe"),
abstract: lorem(80)
)
#doc
]

= Introduction
#lorem(300)

= Related ork
#lorem(200)

0 comments on commit 122436f

Please sign in to comment.