mirror of
https://github.com/typst/typst
synced 2025-08-10 05:07:55 +08:00
MathML output for accents.
This commit is contained in:
parent
df15d4009c
commit
d2b1d7e98a
@ -480,6 +480,8 @@ pub mod tag {
|
|||||||
mfrac
|
mfrac
|
||||||
mi
|
mi
|
||||||
mmultiscripts
|
mmultiscripts
|
||||||
|
mo
|
||||||
|
mover
|
||||||
mprescripts
|
mprescripts
|
||||||
mrow
|
mrow
|
||||||
msub
|
msub
|
||||||
|
@ -165,7 +165,8 @@ impl Synthesize for Packed<EquationElem> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
use crate::foundations::SequenceElem;
|
use crate::foundations::SequenceElem;
|
||||||
use crate::math::{AttachElem, FracElem, LrElem, PrimesElem};
|
use crate::math::{AccentElem, AttachElem, FracElem, LrElem, PrimesElem};
|
||||||
|
use ecow::eco_format;
|
||||||
fn bla(elem: &Content, engine: &mut Engine, styles: StyleChain) -> SourceResult<Content> {
|
fn bla(elem: &Content, engine: &mut Engine, styles: StyleChain) -> SourceResult<Content> {
|
||||||
dbg!(elem);
|
dbg!(elem);
|
||||||
if let Some(sequence) = elem.to_packed::<SequenceElem>() {
|
if let Some(sequence) = elem.to_packed::<SequenceElem>() {
|
||||||
@ -186,6 +187,14 @@ fn bla(elem: &Content, engine: &mut Engine, styles: StyleChain) -> SourceResult<
|
|||||||
show_frac(elem, engine, styles)
|
show_frac(elem, engine, styles)
|
||||||
} else if let Some(elem) = elem.to_packed::<AttachElem>() {
|
} else if let Some(elem) = elem.to_packed::<AttachElem>() {
|
||||||
show_attach(elem, engine, styles)
|
show_attach(elem, engine, styles)
|
||||||
|
} else if let Some(elem) = elem.to_packed::<AccentElem>() {
|
||||||
|
let accent = TextElem::packed(eco_format!(" {}", elem.accent.0));
|
||||||
|
let accent = HtmlElem::new(tag::math::mo).with_body(Some(accent)).pack();
|
||||||
|
let body = Content::sequence([elem.base.clone(), accent]);
|
||||||
|
Ok(HtmlElem::new(tag::math::mover)
|
||||||
|
.with_body(Some(body))
|
||||||
|
.pack()
|
||||||
|
.spanned(elem.span()))
|
||||||
} else {
|
} else {
|
||||||
Ok(elem.clone())
|
Ok(elem.clone())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user