summaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-03-11 12:51:38 +0100
committerGitHub <noreply@github.com>2024-03-11 11:51:38 +0000
commit7f0b7a28c7686b7b76ccdc1aa2937c6994c006fe (patch)
tree930ba673979e52317060176a468c02157125cf82 /crates
parent671b67d43f9b4bbad1076588582823ec92322e3b (diff)
Fix figure caption separator synthesis (#3621)
Diffstat (limited to 'crates')
-rw-r--r--crates/typst/src/model/figure.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/crates/typst/src/model/figure.rs b/crates/typst/src/model/figure.rs
index b5698fac..1f8c5759 100644
--- a/crates/typst/src/model/figure.rs
+++ b/crates/typst/src/model/figure.rs
@@ -437,7 +437,7 @@ impl Outlinable for Packed<FigureElem> {
/// caption: [A rectangle],
/// )
/// ```
-#[elem(name = "caption", Show)]
+#[elem(name = "caption", Synthesize, Show)]
pub struct FigureCaption {
/// The caption's position in the figure. Either `{top}` or `{bottom}`.
///
@@ -546,6 +546,14 @@ impl FigureCaption {
}
}
+impl Synthesize for Packed<FigureCaption> {
+ fn synthesize(&mut self, _: &mut Engine, styles: StyleChain) -> SourceResult<()> {
+ let elem = self.as_mut();
+ elem.push_separator(Smart::Custom(elem.get_separator(styles)));
+ Ok(())
+ }
+}
+
impl Show for Packed<FigureCaption> {
#[typst_macros::time(name = "figure.caption", span = self.span())]
fn show(&self, engine: &mut Engine, styles: StyleChain) -> SourceResult<Content> {