summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-03-22 10:48:29 +0100
committerLaurenz <laurmaedje@gmail.com>2021-03-22 10:48:29 +0100
commit39f55481ed7bc5ebc6d310924e90e7b6c0760d3b (patch)
treec5733ae87270e3050a0cec02a936eb843684958a /src
parent83fa2c075eb8e41bd1a29157eb02f814f7f0ae96 (diff)
More consistent documentation 📝
Diffstat (limited to 'src')
-rw-r--r--src/library/base.rs6
-rw-r--r--src/library/image.rs2
-rw-r--r--src/library/markup.rs12
-rw-r--r--src/library/mod.rs6
-rw-r--r--src/library/pad.rs2
-rw-r--r--src/library/shapes.rs16
-rw-r--r--src/library/spacing.rs8
7 files changed, 26 insertions, 26 deletions
diff --git a/src/library/base.rs b/src/library/base.rs
index fdabdc47..48925122 100644
--- a/src/library/base.rs
+++ b/src/library/base.rs
@@ -3,7 +3,7 @@ use crate::pretty::pretty;
use super::*;
-/// `type`: Get the name of a value's type.
+/// `type`: The name of a value's type.
///
/// # Positional parameters
/// - Any value.
@@ -17,7 +17,7 @@ pub fn type_(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
}
}
-/// `repr`: Get the string representation of a value.
+/// `repr`: The string representation of a value.
///
/// # Positional parameters
/// - Any value.
@@ -31,7 +31,7 @@ pub fn repr(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
}
}
-/// `rgb`: Construct an RGB(A) color.
+/// `rgb`: Create an RGB(A) color.
///
/// # Positional parameters
/// - Red component: of type `float`, between 0.0 and 1.0.
diff --git a/src/library/image.rs b/src/library/image.rs
index 10217e31..9f39073b 100644
--- a/src/library/image.rs
+++ b/src/library/image.rs
@@ -6,7 +6,7 @@ use crate::layout::{
AnyNode, Areas, Element, Fragment, Frame, Image, Layout, LayoutContext,
};
-/// `image`: Insert an image.
+/// `image`: An image.
///
/// Supports PNG and JPEG files.
///
diff --git a/src/library/markup.rs b/src/library/markup.rs
index 2fb38193..d7d750ea 100644
--- a/src/library/markup.rs
+++ b/src/library/markup.rs
@@ -28,7 +28,7 @@ pub fn parbreak(_: &mut EvalContext, _: &mut FuncArgs) -> Value {
})
}
-/// `strong`: Signify important text by setting it in bold.
+/// `strong`: Strong text.
///
/// # Syntax
/// This function has dedicated syntax.
@@ -40,7 +40,7 @@ pub fn parbreak(_: &mut EvalContext, _: &mut FuncArgs) -> Value {
/// - Body: optional, of type `template`.
///
/// # Return value
-/// A template that flips the strongness of text. The effect is scoped to the
+/// A template that flips the boldness of text. The effect is scoped to the
/// body if present.
pub fn strong(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let body = args.find::<TemplateValue>(ctx);
@@ -55,7 +55,7 @@ pub fn strong(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
})
}
-/// `emph`: Emphasize text by setting it in italics.
+/// `emph`: Emphasized text.
///
/// # Syntax
/// This function has dedicated syntax.
@@ -67,8 +67,8 @@ pub fn strong(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
/// - Body: optional, of type `template`.
///
/// # Return value
-/// A template that flips whether text is emphasized. The effect is scoped to
-/// the body if present.
+/// A template that flips whether text is set in italics. The effect is scoped
+/// to the body if present.
pub fn emph(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let body = args.find::<TemplateValue>(ctx);
Value::template(Node::EMPH, move |ctx| {
@@ -146,7 +146,7 @@ pub fn heading(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
/// type `boolean`.
///
/// # Return value
-/// A template that sets the text raw, that is, in monospace with optional
+/// A template that sets the text raw, that is, in monospace and optionally with
/// syntax highlighting.
pub fn raw(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let text = args.require::<String>(ctx, RawNode::TEXT).unwrap_or_default();
diff --git a/src/library/mod.rs b/src/library/mod.rs
index 834c9625..62640ef4 100644
--- a/src/library/mod.rs
+++ b/src/library/mod.rs
@@ -53,12 +53,12 @@ pub fn _new() -> Scope {
}
// Syntax functions.
+ func!(Node::LINEBREAK, linebreak);
+ func!(Node::PARBREAK, parbreak);
+ func!(Node::STRONG, strong);
func!(Node::EMPH, emph);
func!(Node::HEADING, heading);
- func!(Node::STRONG, strong);
func!(Node::RAW, raw);
- func!(Node::LINEBREAK, linebreak);
- func!(Node::PARBREAK, parbreak);
// Library functions.
func!("align", align);
diff --git a/src/library/pad.rs b/src/library/pad.rs
index 9f05f7ce..5a685d2a 100644
--- a/src/library/pad.rs
+++ b/src/library/pad.rs
@@ -14,7 +14,7 @@ use crate::layout::PadNode;
/// - Bottom padding: `bottom`, of type `linear` relative to parent height.
///
/// # Return value
-/// A template that pads the body at the sides.
+/// A template that sets the body into a padded area.
pub fn pad(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let all = args.find(ctx);
let left = args.get(ctx, "left");
diff --git a/src/library/shapes.rs b/src/library/shapes.rs
index a5faf73e..9f705ef7 100644
--- a/src/library/shapes.rs
+++ b/src/library/shapes.rs
@@ -4,7 +4,7 @@ use super::*;
use crate::color::Color;
use crate::layout::{BackgroundNode, BackgroundShape, Fill, FixedNode, PadNode};
-/// `rect`: Create a rectangle.
+/// `rect`: A rectangle with optional content.
///
/// # Positional parameters
/// - Body: optional, of type `template`.
@@ -15,7 +15,7 @@ use crate::layout::{BackgroundNode, BackgroundShape, Fill, FixedNode, PadNode};
/// - Fill color: `fill`, of type `color`.
///
/// # Return value
-/// A template that places the body into a rectangle.
+/// A template that inserts a rectangle and sets the body into it.
pub fn rect(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let width = args.get(ctx, "width");
let height = args.get(ctx, "height");
@@ -24,7 +24,7 @@ pub fn rect(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
rect_impl("rect", width, height, None, fill, body)
}
-/// `square`: Create a square.
+/// `square`: A square with optional content.
///
/// # Positional parameters
/// - Body: optional, of type `template`.
@@ -40,7 +40,7 @@ pub fn rect(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
/// to its parent's size, which isn't possible by setting the side length.
///
/// # Return value
-/// A template that places the body into a square.
+/// A template that inserts a square and sets the body into it.
pub fn square(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let length = args.get::<Length>(ctx, "length").map(Linear::from);
let width = length.or_else(|| args.get(ctx, "width"));
@@ -77,7 +77,7 @@ fn rect_impl(
})
}
-/// `ellipse`: Create an ellipse.
+/// `ellipse`: An ellipse with optional content.
///
/// # Positional parameters
/// - Body: optional, of type `template`.
@@ -88,7 +88,7 @@ fn rect_impl(
/// - Fill color: `fill`, of type `color`.
///
/// # Return value
-/// A template that places the body into an ellipse.
+/// A template that inserts an ellipse and sets the body into it.
pub fn ellipse(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let width = args.get(ctx, "width");
let height = args.get(ctx, "height");
@@ -97,7 +97,7 @@ pub fn ellipse(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
ellipse_impl("ellipse", width, height, None, fill, body)
}
-/// `circle`: Create a circle.
+/// `circle`: A circle with optional content.
///
/// # Positional parameters
/// - Body: optional, of type `template`.
@@ -113,7 +113,7 @@ pub fn ellipse(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
/// to its parent's size, which isn't possible by setting the radius.
///
/// # Return value
-/// A template that places the body into a circle.
+/// A template that inserts a circle and sets the body into it.
pub fn circle(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
let radius = args.get::<Length>(ctx, "radius").map(|r| 2.0 * Linear::from(r));
let width = radius.or_else(|| args.get(ctx, "width"));
diff --git a/src/library/spacing.rs b/src/library/spacing.rs
index 5e3b7743..506f6585 100644
--- a/src/library/spacing.rs
+++ b/src/library/spacing.rs
@@ -1,24 +1,24 @@
use super::*;
use crate::layout::SpacingNode;
-/// `h`: Insert horizontal spacing.
+/// `h`: Horizontal spacing.
///
/// # Positional parameters
/// - Amount of spacing: of type `linear` relative to current font size.
///
/// # Return value
-/// A template that adds horizontal spacing.
+/// A template that inserts horizontal spacing.
pub fn h(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
spacing_impl(ctx, args, SpecAxis::Horizontal)
}
-/// `v`: Insert vertical spacing.
+/// `v`: Vertical spacing.
///
/// # Positional parameters
/// - Amount of spacing: of type `linear` relative to current font size.
///
/// # Return value
-/// A template that adds vertical spacing.
+/// A template that inserts vertical spacing.
pub fn v(ctx: &mut EvalContext, args: &mut FuncArgs) -> Value {
spacing_impl(ctx, args, SpecAxis::Vertical)
}