mirror of
https://github.com/typst/typst
synced 2025-08-06 19:27:55 +08:00
Cancelled terms for MathML.
This commit is contained in:
parent
d2b1d7e98a
commit
1cbc4680d6
@ -477,6 +477,7 @@ pub mod tag {
|
||||
|
||||
tags! {
|
||||
math
|
||||
menclose
|
||||
mfrac
|
||||
mi
|
||||
mmultiscripts
|
||||
|
@ -165,7 +165,7 @@ impl Synthesize for Packed<EquationElem> {
|
||||
}
|
||||
|
||||
use crate::foundations::SequenceElem;
|
||||
use crate::math::{AccentElem, AttachElem, FracElem, LrElem, PrimesElem};
|
||||
use crate::math::{AccentElem, AttachElem, CancelElem, FracElem, LrElem, PrimesElem};
|
||||
use ecow::eco_format;
|
||||
fn bla(elem: &Content, engine: &mut Engine, styles: StyleChain) -> SourceResult<Content> {
|
||||
dbg!(elem);
|
||||
@ -187,6 +187,18 @@ fn bla(elem: &Content, engine: &mut Engine, styles: StyleChain) -> SourceResult<
|
||||
show_frac(elem, engine, styles)
|
||||
} else if let Some(elem) = elem.to_packed::<AttachElem>() {
|
||||
show_attach(elem, engine, styles)
|
||||
} else if let Some(elem) = elem.to_packed::<CancelElem>() {
|
||||
let notation = if elem.cross(styles) {
|
||||
"updiagonalstrike downdiagonalstrike"
|
||||
} else if elem.inverted(styles) {
|
||||
"downdiagonalstrike"
|
||||
} else {
|
||||
"updiagonalstrike"
|
||||
};
|
||||
let tag = HtmlElem::new(tag::math::menclose)
|
||||
.with_attr(HtmlAttr::constant("notation"), notation);
|
||||
let body = elem.body.clone();
|
||||
Ok(tag.with_body(Some(body)).pack().spanned(elem.span()))
|
||||
} 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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user