typst/tests/typ/repr.typ
Laurenz 57ca9628c1 Better space coalescing logic 🌧
This creates a smaller state machine helper type for softness coalescing, which does not own the resulting nodes. While this creates a bit more duplication in stack and par builder, it makes it a lot easier to integrate additional logic into the paragraph builder.

Furthermore:
- Line breaks are now "hard", that is, not coalesced with each other.
- Text nodes with equal style are now merged allowing for example `f{}i` to form a ligature.
2021-03-27 21:52:39 +01:00

58 lines
627 B
Typst
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Test representation of values in the document.
---
// Variables.
#let name = "Typst"
#let ke-bab = "Kebab!"
#let α = "Alpha"
{name} \
{ke-bab} \
{α}
// Error: 2-3 unknown variable
{_}
---
// 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} \
// Not in monospace via repr.
#repr(45deg)
---
// Colors.
{#f7a20500}
---
// Strings and escaping.
{"hi"} \
{"a\n[]\"\u{1F680}string"}
---
// Templates.
{[*{"H" + "i"} there*]}
---
// Functions
#let f(x) = x
{rect} \
{f} \
{() => none}