diff options
| author | Laurenz <laurmaedje@gmail.com> | 2022-12-17 16:24:29 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2022-12-17 16:24:29 +0100 |
| commit | 35b16e545b4fce299edbc00c9a9754179fa51634 (patch) | |
| tree | eb1081e55187e59ff6482abc1ac2f1932606ef59 /library/src/text/misc.rs | |
| parent | b6202b646a0d5ecced301d9bac8bfcaf977d7ee4 (diff) | |
Document parameters in comment
Diffstat (limited to 'library/src/text/misc.rs')
| -rw-r--r-- | library/src/text/misc.rs | 58 |
1 files changed, 49 insertions, 9 deletions
diff --git a/library/src/text/misc.rs b/library/src/text/misc.rs index fc4f7d73..20be156a 100644 --- a/library/src/text/misc.rs +++ b/library/src/text/misc.rs @@ -3,7 +3,8 @@ use crate::prelude::*; /// A text space. /// -/// Tags: text. +/// # Tags +/// - text #[func] #[capable(Unlabellable, Behave)] #[derive(Debug, Hash)] @@ -26,7 +27,12 @@ impl Behave for SpaceNode { /// A line break. /// -/// Tags: text. +/// # Parameters +/// - justify: bool (named) +/// Whether to justify the line before the break. +/// +/// # Tags +/// - text #[func] #[capable(Behave)] #[derive(Debug, Hash)] @@ -50,7 +56,12 @@ impl Behave for LinebreakNode { /// Strongly emphasizes content by increasing the font weight. /// -/// Tags: text. +/// # Parameters +/// - body: Content (positional, required) +/// The content to strongly emphasize. +/// +/// # Tags +/// - text #[func] #[capable(Show)] #[derive(Debug, Hash)] @@ -98,7 +109,12 @@ impl Fold for Delta { /// Emphasizes content by flipping the italicness. /// -/// Tags: text. +/// # Parameters +/// - body: Content (positional, required) +/// The content to emphasize. +/// +/// # Tags +/// - text #[func] #[capable(Show)] #[derive(Debug, Hash)] @@ -136,17 +152,27 @@ impl Fold for Toggle { } } -/// Convert a string or content to lowercase. +/// Convert text or content to lowercase. /// -/// Tags: text. +/// # Parameters +/// - text: ToCase (positional, required) +/// The text to convert to lowercase. +/// +/// # Tags +/// - text #[func] pub fn lower(args: &mut Args) -> SourceResult<Value> { case(Case::Lower, args) } -/// Convert a string or content to uppercase. +/// Convert text or content to uppercase. +/// +/// # Parameters +/// - text: ToCase (positional, required) +/// The text to convert to uppercase. /// -/// Tags: text. +/// # Tags +/// - text #[func] pub fn upper(args: &mut Args) -> SourceResult<Value> { case(Case::Upper, args) @@ -162,6 +188,15 @@ fn case(case: Case, args: &mut Args) -> SourceResult<Value> { }) } +/// A value whose case can be changed. +struct ToCase; + +castable! { + ToCase, + _: Str => Self, + _: Content => Self, +} + /// A case transformation on text. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum Case { @@ -183,7 +218,12 @@ impl Case { /// Display text in small capitals. /// -/// Tags: text. +/// # Parameters +/// - text: Content (positional, required) +/// The text to display to small capitals. +/// +/// # Tags +/// - text #[func] pub fn smallcaps(args: &mut Args) -> SourceResult<Value> { let body: Content = args.expect("content")?; |
