Error for parent-scoped figures without placement (#5151)

This commit is contained in:
Laurenz 2024-10-07 16:13:24 +02:00 committed by GitHub
parent db9debca6d
commit 1d2a222818
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -351,6 +351,12 @@ impl Show for Packed<FigureElem> {
.with_float(true) .with_float(true)
.pack() .pack()
.spanned(self.span()); .spanned(self.span());
} else if self.scope(styles) == PlacementScope::Parent {
bail!(
self.span(),
"parent-scoped placement is only available for floating figures";
hint: "you can enable floating placement with `figure(placement: auto, ..)`"
);
} }
Ok(realized) Ok(realized)

View File

@ -77,6 +77,11 @@ We can clearly see that @fig-cylinder and
#lines(15) #lines(15)
--- figure-scope-without-placement ---
// Error: 2-27 parent-scoped placement is only available for floating figures
// Hint: 2-27 you can enable floating placement with `figure(placement: auto, ..)`
#figure(scope: "parent")[]
--- figure-theorem --- --- figure-theorem ---
// Testing show rules with figures with a simple theorem display // Testing show rules with figures with a simple theorem display
#show figure.where(kind: "theorem"): it => { #show figure.where(kind: "theorem"): it => {