mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Add warning for pdf.embed
elem used with HTML (#5829)
This commit is contained in:
parent
3fba256405
commit
25e27169e1
@ -1,9 +1,12 @@
|
|||||||
use ecow::EcoString;
|
use ecow::EcoString;
|
||||||
|
use typst_library::foundations::Target;
|
||||||
use typst_syntax::Spanned;
|
use typst_syntax::Spanned;
|
||||||
|
|
||||||
use crate::diag::{At, SourceResult};
|
use crate::diag::{warning, At, SourceResult};
|
||||||
use crate::engine::Engine;
|
use crate::engine::Engine;
|
||||||
use crate::foundations::{elem, Bytes, Cast, Content, Derived, Packed, Show, StyleChain};
|
use crate::foundations::{
|
||||||
|
elem, Bytes, Cast, Content, Derived, Packed, Show, StyleChain, TargetElem,
|
||||||
|
};
|
||||||
use crate::introspection::Locatable;
|
use crate::introspection::Locatable;
|
||||||
use crate::World;
|
use crate::World;
|
||||||
|
|
||||||
@ -78,7 +81,12 @@ pub struct EmbedElem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Show for Packed<EmbedElem> {
|
impl Show for Packed<EmbedElem> {
|
||||||
fn show(&self, _: &mut Engine, _: StyleChain) -> SourceResult<Content> {
|
fn show(&self, engine: &mut Engine, styles: StyleChain) -> SourceResult<Content> {
|
||||||
|
if TargetElem::target_in(styles) == Target::Html {
|
||||||
|
engine
|
||||||
|
.sink
|
||||||
|
.warn(warning!(self.span(), "embed was ignored during HTML export"));
|
||||||
|
}
|
||||||
Ok(Content::empty())
|
Ok(Content::empty())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user