summaryrefslogtreecommitdiff
path: root/library/src
diff options
context:
space:
mode:
Diffstat (limited to 'library/src')
-rw-r--r--library/src/compute/mod.rs2
-rw-r--r--library/src/layout/enum.rs2
-rw-r--r--library/src/lib.rs4
-rw-r--r--library/src/meta/heading.rs2
-rw-r--r--library/src/meta/mod.rs2
-rw-r--r--library/src/meta/numbering.rs (renamed from library/src/compute/utility.rs)33
-rw-r--r--library/src/text/misc.rs31
7 files changed, 38 insertions, 38 deletions
diff --git a/library/src/compute/mod.rs b/library/src/compute/mod.rs
index 5cfbe158..cf0486db 100644
--- a/library/src/compute/mod.rs
+++ b/library/src/compute/mod.rs
@@ -4,10 +4,8 @@ mod calc;
mod construct;
mod data;
mod foundations;
-mod utility;
pub use self::calc::*;
pub use self::construct::*;
pub use self::data::*;
pub use self::foundations::*;
-pub use self::utility::*;
diff --git a/library/src/layout/enum.rs b/library/src/layout/enum.rs
index 866a6195..53fc3327 100644
--- a/library/src/layout/enum.rs
+++ b/library/src/layout/enum.rs
@@ -1,7 +1,7 @@
use std::str::FromStr;
-use crate::compute::{Numbering, NumberingPattern};
use crate::layout::{BlockNode, GridNode, ParNode, Sizing, Spacing};
+use crate::meta::{Numbering, NumberingPattern};
use crate::prelude::*;
use crate::text::TextNode;
diff --git a/library/src/lib.rs b/library/src/lib.rs
index 412ebd41..8a231531 100644
--- a/library/src/lib.rs
+++ b/library/src/lib.rs
@@ -42,6 +42,7 @@ fn global(math: Module, calc: Module) -> Module {
global.def_func::<text::StrikeNode>("strike");
global.def_func::<text::OverlineNode>("overline");
global.def_func::<text::RawNode>("raw");
+ global.def_func::<text::LoremFunc>("lorem");
// Math.
global.define("math", math);
@@ -86,6 +87,7 @@ fn global(math: Module, calc: Module) -> Module {
global.def_func::<meta::LinkNode>("link");
global.def_func::<meta::OutlineNode>("outline");
global.def_func::<meta::HeadingNode>("heading");
+ global.def_func::<meta::NumberingFunc>("numbering");
// Symbols.
global.define("sym", symbols::sym());
@@ -110,8 +112,6 @@ fn global(math: Module, calc: Module) -> Module {
global.def_func::<compute::CsvFunc>("csv");
global.def_func::<compute::JsonFunc>("json");
global.def_func::<compute::XmlFunc>("xml");
- global.def_func::<compute::LoremFunc>("lorem");
- global.def_func::<compute::NumberingFunc>("numbering");
// Calc.
global.define("calc", calc);
diff --git a/library/src/meta/heading.rs b/library/src/meta/heading.rs
index b5b0fd9e..c9032e88 100644
--- a/library/src/meta/heading.rs
+++ b/library/src/meta/heading.rs
@@ -1,6 +1,6 @@
use typst::font::FontWeight;
-use crate::compute::Numbering;
+use super::Numbering;
use crate::layout::{BlockNode, VNode};
use crate::prelude::*;
use crate::text::{SpaceNode, TextNode, TextSize};
diff --git a/library/src/meta/mod.rs b/library/src/meta/mod.rs
index fd72a8cb..07f449a4 100644
--- a/library/src/meta/mod.rs
+++ b/library/src/meta/mod.rs
@@ -3,11 +3,13 @@
mod document;
mod heading;
mod link;
+mod numbering;
mod outline;
mod reference;
pub use self::document::*;
pub use self::heading::*;
pub use self::link::*;
+pub use self::numbering::*;
pub use self::outline::*;
pub use self::reference::*;
diff --git a/library/src/compute/utility.rs b/library/src/meta/numbering.rs
index 2220c890..c187c18d 100644
--- a/library/src/compute/utility.rs
+++ b/library/src/meta/numbering.rs
@@ -3,37 +3,6 @@ use std::str::FromStr;
use crate::prelude::*;
use crate::text::Case;
-/// # 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
-/// utility
-#[func]
-pub fn lorem(args: &mut Args) -> SourceResult<Value> {
- let words: usize = args.expect("number of words")?;
- Ok(Value::Str(lipsum::lipsum(words).into()))
-}
-
/// # Numbering
/// Apply a numbering to a sequence of numbers.
///
@@ -93,7 +62,7 @@ pub fn lorem(args: &mut Args) -> SourceResult<Value> {
/// - returns: any
///
/// ## Category
-/// utility
+/// meta
#[func]
pub fn numbering(vm: &Vm, args: &mut Args) -> SourceResult<Value> {
let numbering = args.expect::<Numbering>("pattern or function")?;
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()))
+}