diff options
Diffstat (limited to 'library/src/text/misc.rs')
| -rw-r--r-- | library/src/text/misc.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/library/src/text/misc.rs b/library/src/text/misc.rs index 184294d4..43aea021 100644 --- a/library/src/text/misc.rs +++ b/library/src/text/misc.rs @@ -345,3 +345,34 @@ pub fn smallcaps(args: &mut Args) -> SourceResult<Value> { let body: Content = args.expect("content")?; Ok(Value::Content(body.styled(TextNode::SMALLCAPS, true))) } + +/// # Blind Text +/// Create blind text. +/// +/// This function yields a Latin-like _Lorem Ipsum_ blind text with the given +/// number of words. The sequence of words generated by the function is always +/// the same but randomly chosen. As usual for blind texts, it does not make any +/// sense. Use it as a placeholder to try layouts. +/// +/// ## Example +/// ```example +/// = Blind Text +/// #lorem(30) +/// +/// = More Blind Text +/// #lorem(15) +/// ``` +/// +/// ## Parameters +/// - words: `usize` (positional, required) +/// The length of the blind text in words. +/// +/// - returns: string +/// +/// ## Category +/// text +#[func] +pub fn lorem(args: &mut Args) -> SourceResult<Value> { + let words: usize = args.expect("number of words")?; + Ok(Value::Str(lipsum::lipsum(words).into())) +} |
