diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-02-14 09:45:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-14 08:45:25 +0000 |
| commit | 8ed1eff7b5b76b72eef8e67ee9120e5d24925aa7 (patch) | |
| tree | 0e4a22d7844afcc177094376c68b60d04fcd08e7 | |
| parent | 1f68e157259f1eb55b0eb22f06bb1b589d398971 (diff) | |
Fix text show-set regression (#3410)
| -rw-r--r-- | crates/typst/src/realize/process.rs | 6 | ||||
| -rw-r--r-- | tests/ref/compiler/show-set-text.png | bin | 0 -> 8734 bytes | |||
| -rw-r--r-- | tests/typ/compiler/show-set-text.typ | 41 |
3 files changed, 46 insertions, 1 deletions
diff --git a/crates/typst/src/realize/process.rs b/crates/typst/src/realize/process.rs index 73d5cc4f..a5acd8fc 100644 --- a/crates/typst/src/realize/process.rs +++ b/crates/typst/src/realize/process.rs @@ -129,7 +129,11 @@ fn verdict<'a>( continue; } - if let Transformation::Style(transform) = &recipe.transform { + // Special handling for show-set rules. Exception: Regex show rules, + // those need to be handled like normal transformations. + if let (Transformation::Style(transform), false) = + (&recipe.transform, matches!(&recipe.selector, Some(Selector::Regex(_)))) + { // If this is a show-set for an unprepared element, we need to apply // it. if !prepared { diff --git a/tests/ref/compiler/show-set-text.png b/tests/ref/compiler/show-set-text.png Binary files differnew file mode 100644 index 00000000..27803e8a --- /dev/null +++ b/tests/ref/compiler/show-set-text.png diff --git a/tests/typ/compiler/show-set-text.typ b/tests/typ/compiler/show-set-text.typ new file mode 100644 index 00000000..464cad90 --- /dev/null +++ b/tests/typ/compiler/show-set-text.typ @@ -0,0 +1,41 @@ +// Text show-set rules are weird. + +--- +#show "He": set text(red) +#show "ya": set text(blue) +Heya + +--- +#show "Heya": set text(red) +#show "ya": set text(blue) +Heya + +--- +#show "He": set text(red) +#show "Heya": set text(blue) +Heya + +--- +#show "Heya": set text(red) +#show "yaho": set text(blue) +Heyaho + +--- +#show "He": set text(red) +#show "ya": set text(weight: "bold") +Heya + +--- +#show "Heya": set text(red) +#show "ya": set text(weight: "bold") +Heya + +--- +#show "He": set text(red) +#show "Heya": set text(weight: "bold") +Heya + +--- +#show "Heya": set text(red) +#show "yaho": set text(weight: "bold") +Heyaho |
