diff options
| author | Ian Wrzesinski <wrzian@umich.edu> | 2024-07-29 00:25:03 -0500 |
|---|---|---|
| committer | Ian Wrzesinski <wrzian@umich.edu> | 2025-01-23 16:28:29 -0500 |
| commit | c47b71b4350434a73734789ebde1374b791dc88e (patch) | |
| tree | 0157e3dc277010bb9581eac8a5881109aedc269f /crates/typst-realize | |
| parent | 0b8b7d0f233f748a5c12d1b8e31f657803122eba (diff) | |
Basic SymbolElem addition
Diffstat (limited to 'crates/typst-realize')
| -rw-r--r-- | crates/typst-realize/src/lib.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crates/typst-realize/src/lib.rs b/crates/typst-realize/src/lib.rs index 6ab6d81c..99db2ef1 100644 --- a/crates/typst-realize/src/lib.rs +++ b/crates/typst-realize/src/lib.rs @@ -16,7 +16,7 @@ use typst_library::engine::Engine; use typst_library::foundations::{ Content, Context, ContextElem, Element, NativeElement, Recipe, RecipeIndex, Selector, SequenceElem, Show, ShowSet, Style, StyleChain, StyleVec, StyledElem, Styles, - Synthesize, Transformation, + SymbolElem, Synthesize, Transformation, }; use typst_library::html::{tag, HtmlElem}; use typst_library::introspection::{Locatable, SplitLocator, Tag, TagElem}; @@ -221,7 +221,7 @@ impl<'a, 'x, 'y, 'z, 's> Grouped<'a, 'x, 'y, 'z, 's> { /// Handles an arbitrary piece of content during realization. fn visit<'a>( s: &mut State<'a, '_, '_, '_>, - content: &'a Content, + mut content: &'a Content, styles: StyleChain<'a>, ) -> SourceResult<()> { // Tags can always simply be pushed. @@ -230,6 +230,12 @@ fn visit<'a>( return Ok(()); } + if let Some(elem) = content.to_packed::<SymbolElem>() { + // This is a hack to avoid affecting layout that will be replaced in a + // later commit. + content = Box::leak(Box::new(TextElem::packed(elem.text.to_string()))); + } + // Transformations for math content based on the realization kind. Needs // to happen before show rules. if visit_math_rules(s, content, styles)? { |
