diff --git a/src/model/content.rs b/src/model/content.rs index 71a5cb84b..8b60ab448 100644 --- a/src/model/content.rs +++ b/src/model/content.rs @@ -177,7 +177,7 @@ impl Content { pub fn field(&self, name: &str) -> Option { if let (Some(iter), "children") = (self.to_sequence(), name) { Some(Value::Array(iter.cloned().map(Value::Content).collect())) - } else if let (Some((child, _)), "child") = (self.to_styled(), "child") { + } else if let (Some((child, _)), "child") = (self.to_styled(), name) { Some(Value::Content(child.clone())) } else { self.field_ref(name).cloned() diff --git a/tests/typ/compiler/label.typ b/tests/typ/compiler/label.typ index 58b0dee94..407a849d4 100644 --- a/tests/typ/compiler/label.typ +++ b/tests/typ/compiler/label.typ @@ -56,3 +56,10 @@ _Visible_ --- // Test that incomplete label is text. 1 < 2 is #if 1 < 2 [not] a label. + +--- +// Test label on text, styled, and sequence. +// Ref: false +#test([Hello].label, ) +#test([#[A *B* C]].label, ) +#test([#text(red)[Hello]].label, )