From 551ea99d05166b0be50792f767ddd38b996e32fa Mon Sep 17 00:00:00 2001 From: Laurenz Date: Wed, 17 May 2023 14:41:46 +0200 Subject: Show default values in documentation Fixes #169 Fixes #1102 --- library/src/math/cancel.rs | 13 +++++-------- library/src/math/delimited.rs | 2 -- library/src/math/op.rs | 2 -- 3 files changed, 5 insertions(+), 12 deletions(-) (limited to 'library/src/math') diff --git a/library/src/math/cancel.rs b/library/src/math/cancel.rs index 9a0ffb7a..643eb9eb 100644 --- a/library/src/math/cancel.rs +++ b/library/src/math/cancel.rs @@ -24,8 +24,6 @@ pub struct CancelElem { /// the whole element being "cancelled". A value of `{100%}` would then have /// the line span precisely the element's diagonal. /// - /// Defaults to `{100% + 3pt}`. - /// /// ```example /// >>> #set page(width: 140pt) /// $ a + cancel(x, length: #200%) @@ -37,8 +35,6 @@ pub struct CancelElem { /// If the cancel line should be inverted (pointing to the top left instead /// of top right). /// - /// Defaults to `{false}`. - /// /// ```example /// >>> #set page(width: 140pt) /// $ (a cancel((b + c), inverted: #true)) / @@ -50,8 +46,6 @@ pub struct CancelElem { /// If two opposing cancel lines should be drawn, forming a cross over the /// element. Overrides `inverted`. /// - /// Defaults to `{false}`. - /// /// ```example /// >>> #set page(width: 140pt) /// $ cancel(Pi, cross: #true) $ @@ -85,6 +79,11 @@ pub struct CancelElem { /// ``` #[resolve] #[fold] + #[default(PartialStroke { + // Default stroke has 0.5pt for better visuals. + thickness: Smart::Custom(Abs::pt(0.5)), + ..Default::default() + })] pub stroke: PartialStroke, } @@ -100,10 +99,8 @@ impl LayoutMath for CancelElem { let span = self.span(); let length = self.length(styles).resolve(styles); - // Default stroke has 0.5pt for better visuals. let stroke = self.stroke(styles).unwrap_or(Stroke { paint: TextElem::fill_in(styles), - thickness: Abs::pt(0.5), ..Default::default() }); diff --git a/library/src/math/delimited.rs b/library/src/math/delimited.rs index a4639de6..403f7922 100644 --- a/library/src/math/delimited.rs +++ b/library/src/math/delimited.rs @@ -19,8 +19,6 @@ pub(super) const DELIM_SHORT_FALL: Em = Em::new(0.1); #[element(LayoutMath)] pub struct LrElem { /// The size of the brackets, relative to the height of the wrapped content. - /// - /// Defaults to `{100%}`. pub size: Smart>, /// The delimited content, including the delimiters. diff --git a/library/src/math/op.rs b/library/src/math/op.rs index 1a3acaa3..cc57eb61 100644 --- a/library/src/math/op.rs +++ b/library/src/math/op.rs @@ -27,8 +27,6 @@ pub struct OpElem { pub text: EcoString, /// Whether the operator should force attachments to display as limits. - /// - /// Defaults to `{false}`. #[default(false)] pub limits: bool, } -- cgit v1.2.3