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/visualize/path.rs | 7 +++++-- library/src/visualize/polygon.rs | 12 +++--------- library/src/visualize/shape.rs | 39 ++++++--------------------------------- 3 files changed, 14 insertions(+), 44 deletions(-) (limited to 'library/src/visualize') diff --git a/library/src/visualize/path.rs b/library/src/visualize/path.rs index 9b3fd876..c9b596c7 100644 --- a/library/src/visualize/path.rs +++ b/library/src/visualize/path.rs @@ -27,8 +27,11 @@ pub struct PathElem { /// [non-zero winding rule](https://en.wikipedia.org/wiki/Nonzero-rule). pub fill: Option, - /// How to stroke the path. See the - /// [polygon's documentation]($func/polygon.stroke) for more details. + /// How to stroke the path. This can be: + /// + /// See the [line's documentation]($func/line.stroke) for more details. Can + /// be set to `{none}` to disable the stroke or to `{auto}` for a stroke of + /// `{1pt}` black if and if only if no fill is given. #[resolve] #[fold] pub stroke: Smart>, diff --git a/library/src/visualize/polygon.rs b/library/src/visualize/polygon.rs index 2e75aff5..d2d3132a 100644 --- a/library/src/visualize/polygon.rs +++ b/library/src/visualize/polygon.rs @@ -29,15 +29,9 @@ pub struct PolygonElem { /// How to stroke the polygon. This can be: /// - /// - `{none}` to disable the stroke. - /// - `{auto}` for a stroke of `{1pt}` black if and if only if no fill is - /// given. - /// - A length specifying the stroke's thickness. The color is inherited, - /// defaulting to black. - /// - A color to use for the stroke. The thickness is inherited, defaulting - /// to `{1pt}`. - /// - A stroke combined from color and thickness using the `+` operator as - /// in `{2pt + red}`. + /// See the [line's documentation]($func/line.stroke) for more details. Can + /// be set to `{none}` to disable the stroke or to `{auto}` for a stroke of + /// `{1pt}` black if and if only if no fill is given. #[resolve] #[fold] pub stroke: Smart>, diff --git a/library/src/visualize/shape.rs b/library/src/visualize/shape.rs index ca780f90..6129b70b 100644 --- a/library/src/visualize/shape.rs +++ b/library/src/visualize/shape.rs @@ -38,32 +38,13 @@ pub struct RectElem { /// How to stroke the rectangle. This can be: /// - /// - `{none}` to disable the stroke. - /// - `{auto}` for a stroke of `{1pt}` black if and if only if no fill is + /// - `{none}` to disable stroking + /// - `{auto}` for a stroke of `{1pt + black}` if and if only if no fill is /// given. - /// - A length specifying the stroke's thickness. The color is inherited, - /// defaulting to black. - /// - A color to use for the stroke. The thickness is inherited, defaulting - /// to `{1pt}`. - /// - A stroke combined from color and thickness using the `+` operator as - /// in `{2pt + red}`. - /// - A stroke described by a dictionary with any of the following keys: - /// - `color`: the color to use for the stroke - /// - `thickness`: the stroke's thickness - /// - `cap`: one of `"butt"`, `"round"` or `"square"`, the line cap of the stroke - /// - `join`: one of `"miter"`, `"round"` or `"bevel"`, the line join of the stroke - /// - `miter-limit`: the miter limit to use if `join` is `"miter"`, defaults to 4.0 - /// - `dash`: the dash pattern to use. Can be any of the following: - /// - One of the strings `"solid"`, `"dotted"`, `"densely-dotted"`, `"loosely-dotted"`, - /// `"dashed"`, `"densely-dashed"`, `"loosely-dashed"`, `"dash-dotted"`, - /// `"densely-dash-dotted"` or `"loosely-dash-dotted"` - /// - An array with elements that specify the lengths of dashes and gaps, alternating. - /// Elements can also be the string `"dot"` for a length equal to the line thickness. - /// - A dict with the keys `array`, same as the array above, and `phase`, the offset to - /// the start of the first dash. - /// - Another dictionary describing the stroke for each side inidvidually. - /// The dictionary can contain the following keys in order - /// of precedence: + /// - Any kind of stroke that can also be used for + /// [lines]($func/line.stroke). + /// - A dictionary describing the stroke for each side inidvidually. The + /// dictionary can contain the following keys in order of precedence: /// - `top`: The top stroke. /// - `right`: The right stroke. /// - `bottom`: The bottom stroke. @@ -126,8 +107,6 @@ pub struct RectElem { /// How much to pad the rectangle's content. /// - /// The default value is `{5pt}`. - /// /// _Note:_ When the rectangle contains text, its exact size depends on the /// current [text edges]($func/text.top-edge). /// @@ -242,8 +221,6 @@ pub struct SquareElem { /// How much to pad the square's content. See the [rectangle's /// documentation]($func/rect.inset) for more details. - /// - /// The default value is `{5pt}`. #[resolve] #[fold] #[default(Sides::splat(Abs::pt(5.0).into()))] @@ -326,8 +303,6 @@ pub struct EllipseElem { /// How much to pad the ellipse's content. See the [rectangle's /// documentation]($func/rect.inset) for more details. - /// - /// The default value is `{5pt}`. #[resolve] #[fold] #[default(Sides::splat(Abs::pt(5.0).into()))] @@ -436,8 +411,6 @@ pub struct CircleElem { /// How much to pad the circle's content. See the [rectangle's /// documentation]($func/rect.inset) for more details. - /// - /// The default value is `{5pt}`. #[resolve] #[fold] #[default(Sides::splat(Abs::pt(5.0).into()))] -- cgit v1.2.3