diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-08-17 22:04:18 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-08-17 22:20:37 +0200 |
| commit | 594809e35b9e768f1a50926cf5e7a9df41ba7d16 (patch) | |
| tree | 488f201599a67329d7916b9b3ecb73dd27ad24d7 /tests/typ/layout | |
| parent | c53d98a22f367a9eecfb45d1b22f1be5c6cf908d (diff) | |
Library functions behave more imperatively
- Templates scope state changes
- State-modifying function operate in place instead of returning a template
- Internal template representation contains actual owned nodes instead of a pointer to a syntax tree + an expression map
- No more wide calls
Diffstat (limited to 'tests/typ/layout')
| -rw-r--r-- | tests/typ/layout/containers.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/grid-1.typ | 8 | ||||
| -rw-r--r-- | tests/typ/layout/grid-2.typ | 2 | ||||
| -rw-r--r-- | tests/typ/layout/grid-3.typ | 10 | ||||
| -rw-r--r-- | tests/typ/layout/pad.typ | 11 | ||||
| -rw-r--r-- | tests/typ/layout/page.typ | 37 | ||||
| -rw-r--r-- | tests/typ/layout/pagebreak.typ | 4 |
7 files changed, 38 insertions, 36 deletions
diff --git a/tests/typ/layout/containers.typ b/tests/typ/layout/containers.typ index 75e2617b..b2835b5e 100644 --- a/tests/typ/layout/containers.typ +++ b/tests/typ/layout/containers.typ @@ -12,7 +12,7 @@ Apart --- // Test block over multiple pages. -#page!(height: 60pt) +#page(height: 60pt) First! #block[ diff --git a/tests/typ/layout/grid-1.typ b/tests/typ/layout/grid-1.typ index 1b66bab4..92a1b990 100644 --- a/tests/typ/layout/grid-1.typ +++ b/tests/typ/layout/grid-1.typ @@ -3,7 +3,7 @@ --- #let rect(width, fill) = rect(width: width, height: 2cm, fill: fill) -#page!(width: 100pt, height: 140pt) +#page(width: 100pt, height: 140pt) #grid( columns: (auto, 1fr, 3fr, 0.25cm, 3%, 2mm + 10%), rect(0.5cm, rgb("2a631a")), @@ -33,7 +33,7 @@ ) --- -#page!(height: 3cm, width: 2cm) +#page(height: 3cm, width: 2cm) #grid( columns: (1fr, 1cm, 1fr, 1fr), column-dir: ttb, @@ -46,8 +46,8 @@ ) --- -#page!(height: 3cm, margins: 0pt) -#align!(center) +#page(height: 3cm, margins: 0pt) +#align(center) #grid( columns: (1fr,), rows: (1fr, auto, 2fr), diff --git a/tests/typ/layout/grid-2.typ b/tests/typ/layout/grid-2.typ index fcb7037e..164801ae 100644 --- a/tests/typ/layout/grid-2.typ +++ b/tests/typ/layout/grid-2.typ @@ -1,7 +1,7 @@ // Test using the `grid` function to create a finance table. --- -#page!(width: 12cm, height: 2.5cm) +#page(width: 12cm, height: 2.5cm) #grid( columns: 5, gutter-columns: (2fr, 1fr, 1fr), diff --git a/tests/typ/layout/grid-3.typ b/tests/typ/layout/grid-3.typ index 7e66eb2e..59abd5c7 100644 --- a/tests/typ/layout/grid-3.typ +++ b/tests/typ/layout/grid-3.typ @@ -1,7 +1,7 @@ // Test grid cells that overflow to the next region. --- -#page!(width: 5cm, height: 3cm) +#page(width: 5cm, height: 3cm) #grid( columns: 2, gutter-rows: 3 * (8pt,), @@ -18,7 +18,7 @@ --- // Test a column that starts overflowing right after another row/column did // that. -#page!(width: 5cm, height: 2cm) +#page(width: 5cm, height: 2cm) #grid( columns: 4 * (1fr,), gutter-rows: (10pt,), @@ -32,7 +32,7 @@ --- // Test two columns in the same row overflowing by a different amount. -#page!(width: 5cm, height: 2cm) +#page(width: 5cm, height: 2cm) #grid( columns: 3 * (1fr,), gutter-rows: (8pt,), @@ -48,7 +48,7 @@ --- // Test grid within a grid, overflowing. -#page!(width: 5cm, height: 2.25cm) +#page(width: 5cm, height: 2.25cm) #grid( columns: 4 * (1fr,), gutter-rows: (10pt,), @@ -62,7 +62,7 @@ --- // Test partition of `fr` units before and after multi-region layout. -#page!(width: 5cm, height: 4cm) +#page(width: 5cm, height: 4cm) #grid( columns: 2 * (1fr,), rows: (1fr, 2fr, auto, 1fr, 1cm), diff --git a/tests/typ/layout/pad.typ b/tests/typ/layout/pad.typ index eba68af2..bce13d42 100644 --- a/tests/typ/layout/pad.typ +++ b/tests/typ/layout/pad.typ @@ -5,10 +5,11 @@ #pad(left: 10pt, [Indented!]) // All sides together. -#rect(fill: conifer)[ - #pad!(10pt, right: 20pt) - #rect(width: 20pt, height: 20pt, fill: rgb("eb5278")) -] +#rect(fill: conifer, + pad(10pt, right: 20pt, + rect(width: 20pt, height: 20pt, fill: rgb("eb5278")) + ) +) Hi #box(pad(left: 10pt)[]) there @@ -27,7 +28,7 @@ Hi #box(pad(left: 10pt)[]) there --- // Test that the pad node doesn't consume the whole region. -#page!(height: 6cm) +#page(height: 6cm) #align(left)[Before] #pad(10pt, image("../../res/tiger.jpg")) diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ index 80a644fb..0de397f3 100644 --- a/tests/typ/layout/page.typ +++ b/tests/typ/layout/page.typ @@ -2,44 +2,45 @@ --- // Set width and height. -#page!(width: 120pt, height: 120pt) -#page(width: 40pt)[High] -#page(height: 40pt)[Wide] +#page(width: 120pt, height: 120pt) +[#page(width: 40pt) High] +[#page(height: 40pt) Wide] // Set all margins at once. -#page(margins: 30pt)[ +[ + #page(margins: 30pt) #align(top, left)[TL] #align(bottom, right)[BR] ] // Set individual margins. -#page!(height: 40pt) -#page(left: 0pt, align(left)[Left]) -#page(right: 0pt, align(right)[Right]) -#page(top: 0pt, align(top)[Top]) -#page(bottom: 0pt, align(bottom)[Bottom]) +#page(height: 40pt) +[#page(left: 0pt) #align(left) Left] +[#page(right: 0pt) #align(right) Right] +[#page(top: 0pt) #align(top) Top] +[#page(bottom: 0pt) #align(bottom) Bottom] // Ensure that specific margins override general margins. -#page(margins: 0pt, left: 20pt)[Overriden] +[#page(margins: 0pt, left: 20pt) Overriden] // Flipped predefined paper. -#page("a11", flip: true)[Flipped A11] +[#page("a11", flip: true) Flipped A11] // Flipped custom page size. -#page!(width: 40pt, height: 120pt) -#page!(flip: true) +#page(width: 40pt, height: 120pt) +#page(flip: true) Wide --- // Test a combination of pages with bodies and normal content. -#page!(height: 50pt) +#page(height: 50pt) -#page[First] -#page[Second] +[#page() First] +[#page() Second] #pagebreak() #pagebreak() Fourth -#page[] +[#page(height: 25pt)] Sixth -#page[Seventh and last] +[#page() Seventh and last] diff --git a/tests/typ/layout/pagebreak.typ b/tests/typ/layout/pagebreak.typ index 20962a71..ab591c87 100644 --- a/tests/typ/layout/pagebreak.typ +++ b/tests/typ/layout/pagebreak.typ @@ -3,7 +3,7 @@ --- First of two #pagebreak() -#page!(height: 40pt) +#page(height: 40pt) --- // Make sure that you can't do page related stuff in a container. @@ -11,7 +11,7 @@ A #box[ B #pagebreak() - #page("a4")[] + #page("a4") ] C |
