diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-09-26 15:39:32 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-09-26 16:12:57 +0200 |
| commit | 704f2fbaf1b4483caa12f249a222c49e44f08961 (patch) | |
| tree | 146f7813fe63409df2c1bbaa487731e992d3ac71 /tests | |
| parent | 2661f1a5066bd5e3f8a9c68e4a5c304c248efcb7 (diff) | |
Description lists, link syntax, and new enum syntax
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/code/comment.png | bin | 2648 -> 797 bytes | |||
| -rw-r--r-- | tests/ref/structure/desc.png | bin | 0 -> 16889 bytes | |||
| -rw-r--r-- | tests/ref/structure/enum.png | bin | 28037 -> 29125 bytes | |||
| -rw-r--r-- | tests/ref/style/show-text.png | bin | 44844 -> 44838 bytes | |||
| -rw-r--r-- | tests/ref/text/escape.png | bin | 14079 -> 13269 bytes | |||
| -rw-r--r-- | tests/ref/text/link.png | bin | 40822 -> 49564 bytes | |||
| -rw-r--r-- | tests/typ/code/comment.typ | 5 | ||||
| -rw-r--r-- | tests/typ/math/basic.typ | 10 | ||||
| -rw-r--r-- | tests/typ/structure/desc.typ | 48 | ||||
| -rw-r--r-- | tests/typ/structure/enum.typ | 29 | ||||
| -rw-r--r-- | tests/typ/structure/list.typ | 2 | ||||
| -rw-r--r-- | tests/typ/style/set.typ | 6 | ||||
| -rw-r--r-- | tests/typ/text/escape.typ | 7 | ||||
| -rw-r--r-- | tests/typ/text/justify.typ | 4 | ||||
| -rw-r--r-- | tests/typ/text/linebreak.typ | 6 | ||||
| -rw-r--r-- | tests/typ/text/link.typ | 13 | ||||
| -rw-r--r-- | tests/typ/text/par.typ | 2 |
17 files changed, 90 insertions, 42 deletions
diff --git a/tests/ref/code/comment.png b/tests/ref/code/comment.png Binary files differindex b1c630a9..5928dc87 100644 --- a/tests/ref/code/comment.png +++ b/tests/ref/code/comment.png diff --git a/tests/ref/structure/desc.png b/tests/ref/structure/desc.png Binary files differnew file mode 100644 index 00000000..e8b1d151 --- /dev/null +++ b/tests/ref/structure/desc.png diff --git a/tests/ref/structure/enum.png b/tests/ref/structure/enum.png Binary files differindex 0fcae99d..20bb08d4 100644 --- a/tests/ref/structure/enum.png +++ b/tests/ref/structure/enum.png diff --git a/tests/ref/style/show-text.png b/tests/ref/style/show-text.png Binary files differindex b88e1f30..e901b488 100644 --- a/tests/ref/style/show-text.png +++ b/tests/ref/style/show-text.png diff --git a/tests/ref/text/escape.png b/tests/ref/text/escape.png Binary files differindex 5ee9dbf8..96860fc5 100644 --- a/tests/ref/text/escape.png +++ b/tests/ref/text/escape.png diff --git a/tests/ref/text/link.png b/tests/ref/text/link.png Binary files differindex fd1a3f21..59e62bea 100644 --- a/tests/ref/text/link.png +++ b/tests/ref/text/link.png diff --git a/tests/typ/code/comment.typ b/tests/typ/code/comment.typ index db0a17a4..4a4dc7ab 100644 --- a/tests/typ/code/comment.typ +++ b/tests/typ/code/comment.typ @@ -25,11 +25,6 @@ Still comment. E --- -// Line comments have a special case for URLs. -https://example.com \ -https:/* block comments don't ... */ - ---- // End should not appear without start. // Error: 7-9 unexpected end of block comment /* */ */ diff --git a/tests/typ/math/basic.typ b/tests/typ/math/basic.typ index df05a567..77d2e535 100644 --- a/tests/typ/math/basic.typ +++ b/tests/typ/math/basic.typ @@ -5,15 +5,15 @@ The sum of $a$ and $b$ is $a + b$. --- We will show that: -$[ a^2 + b^2 = c^2 ]$ +$ a^2 + b^2 = c^2 $ --- Prove by induction: -$[ \sum_{k=0}^n k = \frac{n(n+1)}{2} ]$ +$ \sum_{k=0}^n k = \frac{n(n+1)}{2} $ --- // Test that blackboard style looks nice. -$[ f: \mathbb{N} \rightarrow \mathbb{R} ]$ +$ f: \mathbb{N} \rightarrow \mathbb{R} $ --- #set math(family: "IBM Plex Sans") @@ -26,5 +26,5 @@ $a$ $\sqrt{x$ --- -// Error: 2:1 expected closing bracket and dollar sign -$[a +// Error: 2:1 expected dollar sign +$a diff --git a/tests/typ/structure/desc.typ b/tests/typ/structure/desc.typ new file mode 100644 index 00000000..e12bbd16 --- /dev/null +++ b/tests/typ/structure/desc.typ @@ -0,0 +1,48 @@ +// Test description lists. + +--- +/ +No: list \ +/No: list + +--- +// Test with constructor. +#desc( + (term: [One], body: [First]), + (term: [Two], body: [Second]), +) + +--- +// Test joining. +#for word in lorem(4).split().map(s => s.trim(".")) [ + / #word: Latin stuff. +] + +--- +// Test multiline. +#set text(8pt) + +/ Fruit: A tasty, edible thing. +/ Veggie: + An important energy source + for vegetarians. + +--- +// Test style change. +#set text(8pt) + +/ First list: #lorem(4) +#set desc(body-indent: 30pt) +/ Second list: #lorem(4) + +--- +// Test grid like show rule. +#show it: desc as table( + columns: 2, + padding: 3pt, + ..it.items.map(item => (emph(item.term), item.body)).flatten(), +) + +/ A: One letter +/ BB: Two letters +/ CCC: Three letters diff --git a/tests/typ/structure/enum.typ b/tests/typ/structure/enum.typ index 7bd6fa88..eb1d9a9d 100644 --- a/tests/typ/structure/enum.typ +++ b/tests/typ/structure/enum.typ @@ -1,4 +1,4 @@ -// Test enums. +// Test enumerations. --- #enum[Embrace][Extend][Extinguish] @@ -12,28 +12,28 @@ --- 2. Second 1. First - . Indented + + Indented --- // Test automatic numbering in summed content. #for i in range(5) { - [. #roman(1 + i)] + [+ #roman(1 + i)] } --- // Test label pattern. #set enum(label: "~ A:") -. First -. Second +1. First + + Second #set enum(label: "(*)") -. A -. B -. C ++ A ++ B ++ C #set enum(label: "i)") -. A -. B ++ A ++ B --- // Test label closure. @@ -47,12 +47,13 @@ --- #set enum(label: n => n > 1) -. A -. B ++ A ++ B --- -// Lone dot is not a list. -. +// Lone plus is not an enum. ++ +No enum --- // Error: 18-20 invalid pattern diff --git a/tests/typ/structure/list.typ b/tests/typ/structure/list.typ index 5c410a3f..9a021f31 100644 --- a/tests/typ/structure/list.typ +++ b/tests/typ/structure/list.typ @@ -1,4 +1,4 @@ -// Test lists. +// Test unordered lists. --- - diff --git a/tests/typ/style/set.typ b/tests/typ/style/set.typ index 830c6661..25dc1b81 100644 --- a/tests/typ/style/set.typ +++ b/tests/typ/style/set.typ @@ -44,9 +44,9 @@ Hello *{x}* move(dy: -0.15em, image(path, width: 1em, height: 1em)) }) -. Monkey -. Rhino -. Tiger ++ Monkey ++ Rhino ++ Tiger --- // Error: 11-25 set is only allowed directly in code and content blocks diff --git a/tests/typ/text/escape.typ b/tests/typ/text/escape.typ index ccaf78e9..95a8a027 100644 --- a/tests/typ/text/escape.typ +++ b/tests/typ/text/escape.typ @@ -2,15 +2,12 @@ --- // Escapable symbols. -\\ \/ \[ \] \{ \} \# \* \_ \ -\= \~ \` \$ \" \' \< \> \@ +\\ \/ \[ \] \{ \} \# \* \_ \+ \= \~ \ +\` \$ \" \' \< \> \@ \( \) \A // No need to escape. ( ) ; -// Unescapable. -\a \: \; \( \) - // Escaped comments. \// \/\* \*\/ diff --git a/tests/typ/text/justify.typ b/tests/typ/text/justify.typ index aa0878d3..e61817a6 100644 --- a/tests/typ/text/justify.typ +++ b/tests/typ/text/justify.typ @@ -21,8 +21,8 @@ D --- // Test forced justification with justified break. -A B C \+ -D E F \+ +A B C #linebreak(justify: true) +D E F #linebreak(justify: true) --- // Test that justificating chinese text is at least a bit sensible. diff --git a/tests/typ/text/linebreak.typ b/tests/typ/text/linebreak.typ index 797e2f7c..d8449bcc 100644 --- a/tests/typ/text/linebreak.typ +++ b/tests/typ/text/linebreak.typ @@ -30,7 +30,7 @@ Trailing break \ \ --- // Test justified breaks. #set par(justify: true) -With a soft \+ -break you can force a break without #linebreak(justified: true) -breaking justification. #linebreak(justified: false) +With a soft #linebreak(justify: true) +break you can force a break without #linebreak(justify: true) +breaking justification. #linebreak(justify: false) Nice! diff --git a/tests/typ/text/link.typ b/tests/typ/text/link.typ index 01c0b88d..99b380f0 100644 --- a/tests/typ/text/link.typ +++ b/tests/typ/text/link.typ @@ -1,8 +1,8 @@ // Test hyperlinking. --- -// Link without body. -#link("https://example.com/") +// Link syntax. +https://example.com/ // Link with body. #link("https://typst.app/")[Some text text text] @@ -10,11 +10,18 @@ // With line break. This link appears #link("https://google.com/")[in the middle of] a paragraph. -// Prefix is trimmed. +// Certain prefixes are trimmed when using the `link` function. Contact #link("mailto:hi@typst.app") or call #link("tel:123") for more information. --- +// Test that the period is trimmed. +https://a.b.?q=%10#. \ +Wahttp://link \ +Nohttps:\//link \ +Nohttp\://comment + +--- // Styled with underline and color. #set link(fill: rgb("283663")) You could also make the diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ index 059653c5..3c465ca8 100644 --- a/tests/typ/text/par.typ +++ b/tests/typ/text/par.typ @@ -39,7 +39,7 @@ Hello fn main() {} ``` -$[ x + y = z ]$ +$ x + y = z $ - List |
