summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/typst/src/model/bibliography.rs11
-rw-r--r--crates/typst/src/model/outline.rs11
2 files changed, 8 insertions, 14 deletions
diff --git a/crates/typst/src/model/bibliography.rs b/crates/typst/src/model/bibliography.rs
index b7a10b92..9fcaad06 100644
--- a/crates/typst/src/model/bibliography.rs
+++ b/crates/typst/src/model/bibliography.rs
@@ -105,8 +105,7 @@ pub struct BibliographyElem {
/// The bibliography's heading will not be numbered by default, but you can
/// force it to be with a show-set rule:
/// `{show bibliography: set heading(numbering: "1.")}`
- #[default(Some(Smart::Auto))]
- pub title: Option<Smart<Content>>,
+ pub title: Smart<Option<Content>>,
/// Whether to include all works from the given bibliography files, even
/// those that weren't cited in the document.
@@ -213,11 +212,9 @@ impl Show for Packed<BibliographyElem> {
const INDENT: Em = Em::new(1.5);
let mut seq = vec![];
- if let Some(title) = self.title(styles) {
- let title = title.unwrap_or_else(|| {
- TextElem::packed(Self::local_name_in(styles)).spanned(self.span())
- });
-
+ if let Some(title) = self.title(styles).unwrap_or_else(|| {
+ Some(TextElem::packed(Self::local_name_in(styles)).spanned(self.span()))
+ }) {
seq.push(
HeadingElem::new(title)
.with_level(Smart::Custom(NonZeroUsize::ONE))
diff --git a/crates/typst/src/model/outline.rs b/crates/typst/src/model/outline.rs
index e9230656..2cf574ce 100644
--- a/crates/typst/src/model/outline.rs
+++ b/crates/typst/src/model/outline.rs
@@ -73,8 +73,7 @@ pub struct OutlineElem {
/// The outline's heading will not be numbered by default, but you can
/// force it to be with a show-set rule:
/// `{show outline: set heading(numbering: "1.")}`
- #[default(Some(Smart::Auto))]
- pub title: Option<Smart<Content>>,
+ pub title: Smart<Option<Content>>,
/// The type of element to include in the outline.
///
@@ -193,11 +192,9 @@ impl Show for Packed<OutlineElem> {
fn show(&self, engine: &mut Engine, styles: StyleChain) -> SourceResult<Content> {
let mut seq = vec![ParbreakElem::new().pack()];
// Build the outline title.
- if let Some(title) = self.title(styles) {
- let title = title.unwrap_or_else(|| {
- TextElem::packed(Self::local_name_in(styles)).spanned(self.span())
- });
-
+ if let Some(title) = self.title(styles).unwrap_or_else(|| {
+ Some(TextElem::packed(Self::local_name_in(styles)).spanned(self.span()))
+ }) {
seq.push(
HeadingElem::new(title)
.with_depth(NonZeroUsize::ONE)