From cfde809feb33bc057e860c5128c74fb9df6f030c Mon Sep 17 00:00:00 2001 From: Laurenz Date: Mon, 2 Sep 2024 20:43:59 +0200 Subject: New realization / Text show rules now work across elements (#4876) --- ...first-region-counter-update-placed-and-line.png | Bin 1525 -> 1524 bytes tests/ref/grid-breaking-expand-vertically.png | Bin 700 -> 703 bytes tests/ref/label-on-text.png | Bin 1404 -> 0 bytes ...page-marginal-style-show-rule-with-set-page.png | Bin 727 -> 716 bytes tests/ref/show-set-text-order-contained-1.png | Bin 488 -> 458 bytes tests/ref/show-set-text-order-contained-2.png | Bin 249 -> 442 bytes tests/ref/show-set-text-order-overlapping-1.png | Bin 653 -> 574 bytes tests/ref/show-set-text-order-overlapping-2.png | Bin 321 -> 574 bytes tests/ref/show-text-after-normal-show.png | Bin 0 -> 736 bytes tests/ref/show-text-apostrophe.png | Bin 0 -> 1530 bytes tests/ref/show-text-citation-smartquote.png | Bin 0 -> 494 bytes tests/ref/show-text-citation.png | Bin 0 -> 527 bytes tests/ref/show-text-linebreak.png | Bin 0 -> 829 bytes tests/ref/show-text-list.png | Bin 0 -> 312 bytes tests/ref/show-text-outer-space.png | Bin 0 -> 548 bytes tests/ref/show-text-smartquote.png | Bin 0 -> 1320 bytes tests/ref/show-text-space-collapsing.png | Bin 0 -> 566 bytes tests/ref/show-text-style-boundary.png | Bin 0 -> 1378 bytes tests/ref/show-text-within-par.png | Bin 0 -> 1790 bytes tests/suite/foundations/label.typ | 9 --- tests/suite/layout/flow/invisibles.typ | 2 +- tests/suite/layout/grid/grid.typ | 4 +- tests/suite/layout/place.typ | 2 +- tests/suite/styling/show-text.typ | 63 +++++++++++++++++++++ 24 files changed, 67 insertions(+), 13 deletions(-) delete mode 100644 tests/ref/label-on-text.png create mode 100644 tests/ref/show-text-after-normal-show.png create mode 100644 tests/ref/show-text-apostrophe.png create mode 100644 tests/ref/show-text-citation-smartquote.png create mode 100644 tests/ref/show-text-citation.png create mode 100644 tests/ref/show-text-linebreak.png create mode 100644 tests/ref/show-text-list.png create mode 100644 tests/ref/show-text-outer-space.png create mode 100644 tests/ref/show-text-smartquote.png create mode 100644 tests/ref/show-text-space-collapsing.png create mode 100644 tests/ref/show-text-style-boundary.png create mode 100644 tests/ref/show-text-within-par.png (limited to 'tests') diff --git a/tests/ref/flow-first-region-counter-update-placed-and-line.png b/tests/ref/flow-first-region-counter-update-placed-and-line.png index 95ca518e..c5950783 100644 Binary files a/tests/ref/flow-first-region-counter-update-placed-and-line.png and b/tests/ref/flow-first-region-counter-update-placed-and-line.png differ diff --git a/tests/ref/grid-breaking-expand-vertically.png b/tests/ref/grid-breaking-expand-vertically.png index 14434d7c..2e1b2db2 100644 Binary files a/tests/ref/grid-breaking-expand-vertically.png and b/tests/ref/grid-breaking-expand-vertically.png differ diff --git a/tests/ref/label-on-text.png b/tests/ref/label-on-text.png deleted file mode 100644 index 67fb1aa8..00000000 Binary files a/tests/ref/label-on-text.png and /dev/null differ diff --git a/tests/ref/page-marginal-style-show-rule-with-set-page.png b/tests/ref/page-marginal-style-show-rule-with-set-page.png index 138f2272..f05c64a7 100644 Binary files a/tests/ref/page-marginal-style-show-rule-with-set-page.png and b/tests/ref/page-marginal-style-show-rule-with-set-page.png differ diff --git a/tests/ref/show-set-text-order-contained-1.png b/tests/ref/show-set-text-order-contained-1.png index 8deaaacd..1bc95e3b 100644 Binary files a/tests/ref/show-set-text-order-contained-1.png and b/tests/ref/show-set-text-order-contained-1.png differ diff --git a/tests/ref/show-set-text-order-contained-2.png b/tests/ref/show-set-text-order-contained-2.png index 00ea3fb8..89309370 100644 Binary files a/tests/ref/show-set-text-order-contained-2.png and b/tests/ref/show-set-text-order-contained-2.png differ diff --git a/tests/ref/show-set-text-order-overlapping-1.png b/tests/ref/show-set-text-order-overlapping-1.png index 71222567..83983b4d 100644 Binary files a/tests/ref/show-set-text-order-overlapping-1.png and b/tests/ref/show-set-text-order-overlapping-1.png differ diff --git a/tests/ref/show-set-text-order-overlapping-2.png b/tests/ref/show-set-text-order-overlapping-2.png index f1b658f2..83983b4d 100644 Binary files a/tests/ref/show-set-text-order-overlapping-2.png and b/tests/ref/show-set-text-order-overlapping-2.png differ diff --git a/tests/ref/show-text-after-normal-show.png b/tests/ref/show-text-after-normal-show.png new file mode 100644 index 00000000..517ad638 Binary files /dev/null and b/tests/ref/show-text-after-normal-show.png differ diff --git a/tests/ref/show-text-apostrophe.png b/tests/ref/show-text-apostrophe.png new file mode 100644 index 00000000..7c328836 Binary files /dev/null and b/tests/ref/show-text-apostrophe.png differ diff --git a/tests/ref/show-text-citation-smartquote.png b/tests/ref/show-text-citation-smartquote.png new file mode 100644 index 00000000..d3a2b5c3 Binary files /dev/null and b/tests/ref/show-text-citation-smartquote.png differ diff --git a/tests/ref/show-text-citation.png b/tests/ref/show-text-citation.png new file mode 100644 index 00000000..9a402dfe Binary files /dev/null and b/tests/ref/show-text-citation.png differ diff --git a/tests/ref/show-text-linebreak.png b/tests/ref/show-text-linebreak.png new file mode 100644 index 00000000..716eca42 Binary files /dev/null and b/tests/ref/show-text-linebreak.png differ diff --git a/tests/ref/show-text-list.png b/tests/ref/show-text-list.png new file mode 100644 index 00000000..4d04a8cf Binary files /dev/null and b/tests/ref/show-text-list.png differ diff --git a/tests/ref/show-text-outer-space.png b/tests/ref/show-text-outer-space.png new file mode 100644 index 00000000..d497af83 Binary files /dev/null and b/tests/ref/show-text-outer-space.png differ diff --git a/tests/ref/show-text-smartquote.png b/tests/ref/show-text-smartquote.png new file mode 100644 index 00000000..9a93c66c Binary files /dev/null and b/tests/ref/show-text-smartquote.png differ diff --git a/tests/ref/show-text-space-collapsing.png b/tests/ref/show-text-space-collapsing.png new file mode 100644 index 00000000..5794cefe Binary files /dev/null and b/tests/ref/show-text-space-collapsing.png differ diff --git a/tests/ref/show-text-style-boundary.png b/tests/ref/show-text-style-boundary.png new file mode 100644 index 00000000..39a440f2 Binary files /dev/null and b/tests/ref/show-text-style-boundary.png differ diff --git a/tests/ref/show-text-within-par.png b/tests/ref/show-text-within-par.png new file mode 100644 index 00000000..e7bccc49 Binary files /dev/null and b/tests/ref/show-text-within-par.png differ diff --git a/tests/suite/foundations/label.typ b/tests/suite/foundations/label.typ index 4875f697..af6d2380 100644 --- a/tests/suite/foundations/label.typ +++ b/tests/suite/foundations/label.typ @@ -19,15 +19,6 @@ The end. #let b = [*B*] #a #b ---- label-on-text --- -// Test labelled text. -#show "t": it => { - set text(blue) if it.has("label") and it.label == - it -} - -This is a thing #[that ] happened. - --- label-dynamic-show-set --- // Test abusing dynamic labels for styling. #show : set text(red) diff --git a/tests/suite/layout/flow/invisibles.typ b/tests/suite/layout/flow/invisibles.typ index 28118cb9..e9c2436f 100644 --- a/tests/suite/layout/flow/invisibles.typ +++ b/tests/suite/layout/flow/invisibles.typ @@ -56,6 +56,6 @@ Mix-and-match all the previous tests. #counter("dummy").step() #place(dx: -0.5cm, dy: -0.75cm, box(width: 200%)[OOF]) #line(length: 100%) - #place(dy: -0.8em)[OOF] + #place(dy: 0.2em)[OOF] #rect(height: 2cm, fill: gray) ] diff --git a/tests/suite/layout/grid/grid.typ b/tests/suite/layout/grid/grid.typ index 2d45095d..d35adca5 100644 --- a/tests/suite/layout/grid/grid.typ +++ b/tests/suite/layout/grid/grid.typ @@ -184,8 +184,8 @@ Top #align(bottom)[ Bottom \ - Bottom \ - #v(0pt) + Bottom + Top ] ], diff --git a/tests/suite/layout/place.typ b/tests/suite/layout/place.typ index 0922800d..c29d2ddd 100644 --- a/tests/suite/layout/place.typ +++ b/tests/suite/layout/place.typ @@ -54,9 +54,9 @@ Second --- place-float --- #set page(height: 140pt) #set place(clearance: 5pt) -#lorem(6) #place(auto, float: true, rect[A]) #place(auto, float: true, rect[B]) +#lorem(6) #place(auto, float: true, rect[C]) #place(auto, float: true, rect[D]) diff --git a/tests/suite/styling/show-text.typ b/tests/suite/styling/show-text.typ index 56b659b2..d073f72e 100644 --- a/tests/suite/styling/show-text.typ +++ b/tests/suite/styling/show-text.typ @@ -131,3 +131,66 @@ Heya #show "Heya": set text(red) #show "yaho": set text(weight: "bold") Heyaho + +--- show-text-smartquote --- +#show "up,\" she": set text(red) +"What's up," she asked. + +--- show-text-apostrophe --- +#show regex("Who's|We've"): highlight +Who's got it? \ +We've got it. + +--- show-text-citation --- +#show "hey": [@arrgh] +@netwok hey + +#show bibliography: none +#bibliography("/assets/bib/works.bib") + +--- show-text-list --- +#show "hi": [- B] +- A +hi +- C + +--- show-text-citation-smartquote --- +#show "hey \"": [@arrgh] +#show "dis": [@distress] +@netwok hey " dis + +#show bibliography: none +#bibliography("/assets/bib/works.bib") + +--- show-text-linebreak --- +#show "lo\nwo": set text(red) +Hello #[ ] \ +#[ ] #[ ] world! + +--- show-text-after-normal-show --- +#show rect: "world" +#show "lo wo": set text(red) +hello #rect() + +--- show-text-space-collapsing --- +#show "i ther": set text(red) +hi#[ ]#[ ]the#"re" + +--- show-text-style-boundary --- +#show "What's up": set text(blue) +#show "your party": underline +What's #[ ] up at #"your" #text(red)[party?] + +--- show-text-within-par --- +#show "Pythagoras'": highlight +$a^2 + b^2 = c^2$ is Pythagoras' theorem. + +--- show-text-outer-space --- +// Spaces must be interior to strong textual elements for matching to work. +// For outer spaces, it is hard to say whether they would collapse. +#show "a\n": set text(blue) +#show "b\n ": set text(blue) +#show " c ": set text(blue) +a \ #h(0pt, weak: true) +b \ #h(0pt, weak: true) +$x$ c $y$ -- cgit v1.2.3