diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-03-08 10:43:03 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-03-08 10:44:24 +0100 |
| commit | 1b2b53ecb91a9bd7fb3493e471ae03cd142a7c03 (patch) | |
| tree | 682124c2343db9491c84bddbdca026c676f220c6 /library/src/layout | |
| parent | 25b5bd117529cd04bb789e1988eb3a3db8025a0e (diff) | |
Require font to be a named argument
Diffstat (limited to 'library/src/layout')
| -rw-r--r-- | library/src/layout/align.rs | 1 | ||||
| -rw-r--r-- | library/src/layout/enum.rs | 59 | ||||
| -rw-r--r-- | library/src/layout/flow.rs | 3 | ||||
| -rw-r--r-- | library/src/layout/list.rs | 3 | ||||
| -rw-r--r-- | library/src/layout/page.rs | 10 | ||||
| -rw-r--r-- | library/src/layout/par.rs | 1 | ||||
| -rw-r--r-- | library/src/layout/spacing.rs | 5 | ||||
| -rw-r--r-- | library/src/layout/terms.rs | 3 | ||||
| -rw-r--r-- | library/src/layout/transform.rs | 13 |
9 files changed, 51 insertions, 47 deletions
diff --git a/library/src/layout/align.rs b/library/src/layout/align.rs index 96c0ae3b..bd9c60fa 100644 --- a/library/src/layout/align.rs +++ b/library/src/layout/align.rs @@ -57,6 +57,7 @@ pub struct AlignNode { /// ) /// ``` #[settable] + #[positional] #[fold] #[skip] #[default(Axes::new(GenAlign::Start, GenAlign::Specific(Align::Top)))] diff --git a/library/src/layout/enum.rs b/library/src/layout/enum.rs index 990c0fb9..edc954d0 100644 --- a/library/src/layout/enum.rs +++ b/library/src/layout/enum.rs @@ -49,20 +49,6 @@ use super::GridLayouter; /// becomes part of that item. /// /// ## Parameters -/// - items: `Content` (positional, variadic) -/// The enumeration's children. -/// -/// When using the enum syntax, adjacent items are automatically collected -/// into enumerations, even through constructs like for loops. -/// -/// ```example -/// #for phase in ( -/// "Launch", -/// "Orbit", -/// "Descent", -/// ) [+ #phase] -/// ``` -/// /// - start: `NonZeroUsize` (named) /// Which number to start the enumeration with. /// @@ -74,31 +60,39 @@ use super::GridLayouter; /// ) /// ``` /// -/// - tight: `bool` (named) -/// If this is `{false}`, the items are spaced apart with -/// [enum spacing]($func/enum.spacing). If it is `{true}`, they use normal -/// [leading]($func/par.leading) instead. This makes the enumeration more -/// compact, which can look better if the items are short. -/// -/// ```example -/// + If an enum has a lot of text, and -/// maybe other inline content, it -/// should not be tight anymore. -/// -/// + To make an enum wide, simply -/// insert a blank line between the -/// items. -/// ``` -/// /// Display: Numbered List /// Category: layout #[node(Construct, Layout)] pub struct EnumNode { /// The numbered list's items. + /// + /// When using the enum syntax, adjacent items are automatically collected + /// into enumerations, even through constructs like for loops. + /// + /// ```example + /// #for phase in ( + /// "Launch", + /// "Orbit", + /// "Descent", + /// ) [+ #phase] + /// ``` #[variadic] pub items: Vec<EnumItem>, - /// If true, the items are separated by leading instead of list spacing. + /// If this is `{false}`, the items are spaced apart with + /// [enum spacing]($func/enum.spacing). If it is `{true}`, they use normal + /// [leading]($func/par.leading) instead. This makes the enumeration more + /// compact, which can look better if the items are short. + /// + /// ```example + /// + If an enum has a lot of text, and + /// maybe other inline content, it + /// should not be tight anymore. + /// + /// + To make an enum wide, simply + /// insert a blank line between the + /// items. + /// ``` #[named] #[default(true)] pub tight: bool, @@ -252,6 +246,9 @@ impl Layout for EnumNode { } /// An enumeration item. +/// +/// Display: Numbered List Item +/// Category: layout #[node] pub struct EnumItem { /// The item's number. diff --git a/library/src/layout/flow.rs b/library/src/layout/flow.rs index ea31752b..02f34857 100644 --- a/library/src/layout/flow.rs +++ b/library/src/layout/flow.rs @@ -8,6 +8,9 @@ use crate::visualize::{CircleNode, EllipseNode, ImageNode, RectNode, SquareNode} /// /// This node is responsible for layouting both the top-level content flow and /// the contents of boxes. +/// +/// Display: Flow +/// Category: layout #[node(Layout)] pub struct FlowNode { /// The children that will be arranges into a flow. diff --git a/library/src/layout/list.rs b/library/src/layout/list.rs index 0ca5ccf6..69d2e717 100644 --- a/library/src/layout/list.rs +++ b/library/src/layout/list.rs @@ -167,6 +167,9 @@ impl Layout for ListNode { } /// A bullet list item. +/// +/// Display: Bullet List Item +/// Category: layout #[node] pub struct ListItem { /// The item's body. diff --git a/library/src/layout/page.rs b/library/src/layout/page.rs index 5d1d530d..3b557981 100644 --- a/library/src/layout/page.rs +++ b/library/src/layout/page.rs @@ -12,11 +12,6 @@ use crate::prelude::*; /// Pages can be set to use `{auto}` as their width or height. In this case, /// the pages will grow to fit their content on the respective axis. /// -/// ## Parameters -/// - paper: `Paper` (positional, settable) -/// A standard paper size to set width and height. When this is not specified, -/// Typst defaults to `{"a4"}` paper. -/// /// ## Example /// ```example /// >>> #set page(margin: auto) @@ -25,6 +20,11 @@ use crate::prelude::*; /// There you go, US friends! /// ``` /// +/// ## Parameters +/// - paper: `Paper` (positional, settable) +/// A standard paper size to set width and height. When this is not specified, +/// Typst defaults to `{"a4"}` paper. +/// /// Display: Page /// Category: layout #[node] diff --git a/library/src/layout/par.rs b/library/src/layout/par.rs index 1b554d62..a55b2dc3 100644 --- a/library/src/layout/par.rs +++ b/library/src/layout/par.rs @@ -45,6 +45,7 @@ use crate::text::{ pub struct ParNode { /// The paragraph's children. #[variadic] + #[skip] pub children: Vec<Content>, /// The indent the first line of a consecutive paragraph should have. diff --git a/library/src/layout/spacing.rs b/library/src/layout/spacing.rs index 94517ad5..9f552730 100644 --- a/library/src/layout/spacing.rs +++ b/library/src/layout/spacing.rs @@ -86,9 +86,6 @@ impl Behave for HNode { /// ``` /// /// ## Parameters -/// - amount: `Spacing` (positional, required) -/// How much spacing to insert. -/// /// - weak: `bool` (named) /// If true, the spacing collapses at the start or end of a flow. Moreover, /// from multiple adjacent weak spacings all but the largest one collapse. @@ -108,7 +105,7 @@ impl Behave for HNode { /// Category: layout #[node(Construct, Behave)] pub struct VNode { - /// The amount of vertical spacing. + /// How much spacing to insert. #[positional] #[required] pub amount: Spacing, diff --git a/library/src/layout/terms.rs b/library/src/layout/terms.rs index 33b59d4d..e8adfdda 100644 --- a/library/src/layout/terms.rs +++ b/library/src/layout/terms.rs @@ -127,6 +127,9 @@ impl Layout for TermsNode { } /// A term list item. +/// +/// Display: Term List Item +/// Category: layout #[node] pub struct TermItem { /// The term described by the list item. diff --git a/library/src/layout/transform.rs b/library/src/layout/transform.rs index 2ab9e5e0..b71cfa9f 100644 --- a/library/src/layout/transform.rs +++ b/library/src/layout/transform.rs @@ -79,12 +79,11 @@ pub struct RotateNode { /// The amount of rotation. /// /// ```example - /// #rotate(angle: -1.571rad)[Space!] + /// #rotate(-1.571rad)[Space!] /// ``` /// - #[named] - #[shorthand] - #[default] + #[positional] + #[required] pub angle: Angle, /// The content to rotate. @@ -104,9 +103,9 @@ pub struct RotateNode { /// #let square = square.with(width: 8pt) /// /// #box(square()) - /// #box(rotate(angle: 30deg, origin: center, square())) - /// #box(rotate(angle: 30deg, origin: top + left, square())) - /// #box(rotate(angle: 30deg, origin: bottom + right, square())) + /// #box(rotate(30deg, origin: center, square())) + /// #box(rotate(30deg, origin: top + left, square())) + /// #box(rotate(30deg, origin: bottom + right, square())) /// ``` #[settable] #[resolve] |
