mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
- Makes errors fatal, so that a phase is only reached when all previous phases were error-free - Parsing still recovers and can produce multiple errors - Evaluation fails fast and can thus produce only a single error (except for parse errors due to an import) - The single error that could occur during execution is removed for now - Removes Value::Error variant
61 lines
692 B
Typst
61 lines
692 B
Typst
// Test representation of values in the document.
|
||
|
||
---
|
||
// Variables.
|
||
#let name = "Typst"
|
||
#let ke-bab = "Kebab!"
|
||
#let α = "Alpha"
|
||
|
||
{name} \
|
||
{ke-bab} \
|
||
{α}
|
||
|
||
---
|
||
// Literal values.
|
||
{none} (empty) \
|
||
{true} \
|
||
{false}
|
||
|
||
---
|
||
// Numerical values.
|
||
{1} \
|
||
{1.0e-4} \
|
||
{3.15} \
|
||
{1e-10} \
|
||
{50.368%} \
|
||
{0.0000012345pt} \
|
||
{4.5cm} \
|
||
{12e1pt} \
|
||
{2.5rad} \
|
||
{45deg}
|
||
|
||
---
|
||
// Colors.
|
||
#rgb("f7a20500")
|
||
|
||
---
|
||
// Strings and escaping.
|
||
{"hi"} \
|
||
{"a\n[]\"\u{1F680}string"}
|
||
|
||
---
|
||
// Templates.
|
||
{[*{"H" + "i"} there*]}
|
||
|
||
---
|
||
// Functions
|
||
#let f(x) = x
|
||
|
||
{rect} \
|
||
{f} \
|
||
{() => none}
|
||
|
||
---
|
||
// Test using the `repr` function.
|
||
|
||
// Returns a string.
|
||
#test(repr((1, 2, false, )), "(1, 2, false)")
|
||
|
||
// Not in monospace
|
||
#repr(23deg)
|