mirror of
https://github.com/typst/typst
synced 2025-05-22 13:05:29 +08:00
add deprecated id for deprecations
cf https://github.com/typst/typst/pull/4562
This commit is contained in:
parent
5d60e48057
commit
b866e58926
@ -46,7 +46,9 @@ pub fn style(
|
|||||||
func: Func,
|
func: Func,
|
||||||
) -> Content {
|
) -> Content {
|
||||||
engine.sink.warn(warning!(
|
engine.sink.warn(warning!(
|
||||||
span, "`style` is deprecated";
|
span,
|
||||||
|
id: "deprecated",
|
||||||
|
message: "`style` is deprecated";
|
||||||
hint: "use a `context` expression instead"
|
hint: "use a `context` expression instead"
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -465,7 +465,9 @@ impl Counter {
|
|||||||
self.display_impl(engine, loc, numbering, both, context.styles().ok())
|
self.display_impl(engine, loc, numbering, both, context.styles().ok())
|
||||||
} else {
|
} else {
|
||||||
engine.sink.warn(warning!(
|
engine.sink.warn(warning!(
|
||||||
span, "`counter.display` without context is deprecated";
|
span,
|
||||||
|
id: "deprecated",
|
||||||
|
message: "`counter.display` without context is deprecated";
|
||||||
hint: "use it in a `context` expression instead"
|
hint: "use it in a `context` expression instead"
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -523,7 +525,9 @@ impl Counter {
|
|||||||
context.location().at(span)?;
|
context.location().at(span)?;
|
||||||
} else {
|
} else {
|
||||||
engine.sink.warn(warning!(
|
engine.sink.warn(warning!(
|
||||||
span, "calling `counter.final` with a location is deprecated";
|
span,
|
||||||
|
id: "deprecated",
|
||||||
|
message: "calling `counter.final` with a location is deprecated";
|
||||||
hint: "try removing the location argument"
|
hint: "try removing the location argument"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,9 @@ pub fn locate(
|
|||||||
}
|
}
|
||||||
LocateInput::Func(func) => {
|
LocateInput::Func(func) => {
|
||||||
engine.sink.warn(warning!(
|
engine.sink.warn(warning!(
|
||||||
span, "`locate` with callback function is deprecated";
|
span,
|
||||||
|
id: "deprecated",
|
||||||
|
message: "`locate` with callback function is deprecated";
|
||||||
hint: "use a `context` expression instead"
|
hint: "use a `context` expression instead"
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -161,7 +161,9 @@ pub fn query(
|
|||||||
context.introspect()?;
|
context.introspect()?;
|
||||||
} else {
|
} else {
|
||||||
engine.sink.warn(warning!(
|
engine.sink.warn(warning!(
|
||||||
span, "calling `query` with a location is deprecated";
|
span,
|
||||||
|
id: "deprecated",
|
||||||
|
message: "calling `query` with a location is deprecated";
|
||||||
hint: "try removing the location argument"
|
hint: "try removing the location argument"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -335,7 +335,9 @@ impl State {
|
|||||||
context.location().at(span)?;
|
context.location().at(span)?;
|
||||||
} else {
|
} else {
|
||||||
engine.sink.warn(warning!(
|
engine.sink.warn(warning!(
|
||||||
span, "calling `state.final` with a location is deprecated";
|
span,
|
||||||
|
id: "deprecated",
|
||||||
|
message: "calling `state.final` with a location is deprecated";
|
||||||
hint: "try removing the location argument"
|
hint: "try removing the location argument"
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@ -382,7 +384,9 @@ impl State {
|
|||||||
func: Option<Func>,
|
func: Option<Func>,
|
||||||
) -> Content {
|
) -> Content {
|
||||||
engine.sink.warn(warning!(
|
engine.sink.warn(warning!(
|
||||||
span, "`state.display` is deprecated";
|
span,
|
||||||
|
id: "deprecated",
|
||||||
|
message: "`state.display` is deprecated";
|
||||||
hint: "use `state.get` in a `context` expression instead"
|
hint: "use `state.get` in a `context` expression instead"
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@ -84,7 +84,9 @@ pub fn measure(
|
|||||||
let styles = match &styles {
|
let styles = match &styles {
|
||||||
Some(styles) => {
|
Some(styles) => {
|
||||||
engine.sink.warn(warning!(
|
engine.sink.warn(warning!(
|
||||||
span, "calling `measure` with a styles argument is deprecated";
|
span,
|
||||||
|
id: "deprecated",
|
||||||
|
message: "calling `measure` with a styles argument is deprecated";
|
||||||
hint: "try removing the styles argument"
|
hint: "try removing the styles argument"
|
||||||
));
|
));
|
||||||
StyleChain::new(styles)
|
StyleChain::new(styles)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user