mirror of
https://github.com/typst/typst
synced 2025-05-15 09:35:28 +08:00
Use third person in documentation (#1560)
This commit is contained in:
parent
48c25f4da0
commit
b96b7b7ee1
@ -51,7 +51,7 @@ pub fn module() -> Module {
|
||||
Module::new("calc").with_scope(scope)
|
||||
}
|
||||
|
||||
/// Calculate the absolute value of a numeric value.
|
||||
/// Calculates the absolute value of a numeric value.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -84,7 +84,7 @@ cast! {
|
||||
v: Fr => Self(Value::Fraction(v.abs())),
|
||||
}
|
||||
|
||||
/// Raise a value to some exponent.
|
||||
/// Raises a value to some exponent.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -139,7 +139,7 @@ pub fn pow(
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Raise a value to some exponent of e.
|
||||
/// Raises a value to some exponent of e.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -173,7 +173,7 @@ pub fn exp(
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Calculate the square root of a number.
|
||||
/// Extracts the square root of a number.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -194,7 +194,7 @@ pub fn sqrt(
|
||||
Ok(value.v.float().sqrt())
|
||||
}
|
||||
|
||||
/// Calculate the sine of an angle.
|
||||
/// Calculates the sine of an angle.
|
||||
///
|
||||
/// When called with an integer or a float, they will be interpreted as
|
||||
/// radians.
|
||||
@ -220,7 +220,7 @@ pub fn sin(
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate the cosine of an angle.
|
||||
/// Calculates the cosine of an angle.
|
||||
///
|
||||
/// When called with an integer or a float, they will be interpreted as
|
||||
/// radians.
|
||||
@ -246,7 +246,7 @@ pub fn cos(
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate the tangent of an angle.
|
||||
/// Calculates the tangent of an angle.
|
||||
///
|
||||
/// When called with an integer or a float, they will be interpreted as
|
||||
/// radians.
|
||||
@ -271,7 +271,7 @@ pub fn tan(
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate the arcsine of a number.
|
||||
/// Calculates the arcsine of a number.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -293,7 +293,7 @@ pub fn asin(
|
||||
Ok(Angle::rad(val.asin()))
|
||||
}
|
||||
|
||||
/// Calculate the arccosine of a number.
|
||||
/// Calculates the arccosine of a number.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -315,7 +315,7 @@ pub fn acos(
|
||||
Ok(Angle::rad(val.acos()))
|
||||
}
|
||||
|
||||
/// Calculate the arctangent of a number.
|
||||
/// Calculates the arctangent of a number.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -333,7 +333,7 @@ pub fn atan(
|
||||
Angle::rad(value.float().atan())
|
||||
}
|
||||
|
||||
/// Calculate the four-quadrant arctangent of a coordinate.
|
||||
/// Calculates the four-quadrant arctangent of a coordinate.
|
||||
///
|
||||
/// The arguments are `(x, y)`, not `(y, x)`.
|
||||
///
|
||||
@ -355,7 +355,7 @@ pub fn atan2(
|
||||
Angle::rad(f64::atan2(y.float(), x.float()))
|
||||
}
|
||||
|
||||
/// Calculate the hyperbolic sine of an angle.
|
||||
/// Calculates the hyperbolic sine of an angle.
|
||||
///
|
||||
/// When called with an integer or a float, they will be interpreted as radians.
|
||||
///
|
||||
@ -379,7 +379,7 @@ pub fn sinh(
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate the hyperbolic cosine of an angle.
|
||||
/// Calculates the hyperbolic cosine of an angle.
|
||||
///
|
||||
/// When called with an integer or a float, they will be interpreted as radians.
|
||||
///
|
||||
@ -403,7 +403,7 @@ pub fn cosh(
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate the hyperbolic tangent of an angle.
|
||||
/// Calculates the hyperbolic tangent of an angle.
|
||||
///
|
||||
/// When called with an integer or a float, they will be interpreted as radians.
|
||||
///
|
||||
@ -427,7 +427,7 @@ pub fn tanh(
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculate the logarithm of a number.
|
||||
/// Calculates the logarithm of a number.
|
||||
///
|
||||
/// If the base is not specified, the logarithm is calculated in base 10.
|
||||
///
|
||||
@ -475,7 +475,7 @@ pub fn log(
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Calculate the natural logarithm of a number.
|
||||
/// Calculates the natural logarithm of a number.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -504,7 +504,7 @@ pub fn ln(
|
||||
Ok(result)
|
||||
}
|
||||
|
||||
/// Calculate the factorial of a number.
|
||||
/// Calculates the factorial of a number.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -521,7 +521,7 @@ pub fn fact(
|
||||
Ok(fact_impl(1, number).ok_or("the result is too large")?)
|
||||
}
|
||||
|
||||
/// Calculate a permutation.
|
||||
/// Calculates a permutation.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -562,7 +562,7 @@ fn fact_impl(start: u64, end: u64) -> Option<i64> {
|
||||
count.try_into().ok()
|
||||
}
|
||||
|
||||
/// Calculate a binomial coefficient.
|
||||
/// Calculates a binomial coefficient.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -603,7 +603,7 @@ fn binom_impl(n: u64, k: u64) -> Option<i64> {
|
||||
result.try_into().ok()
|
||||
}
|
||||
|
||||
/// Calculate the greatest common divisor of two integers.
|
||||
/// Calculates the greatest common divisor of two integers.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -629,7 +629,7 @@ pub fn gcd(
|
||||
a.abs()
|
||||
}
|
||||
|
||||
/// Calculate the least common multiple of two integers.
|
||||
/// Calculates the least common multiple of two integers.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -655,7 +655,7 @@ pub fn lcm(
|
||||
.ok_or("the return value is too large")?)
|
||||
}
|
||||
|
||||
/// Round a number down to the nearest integer.
|
||||
/// Rounds a number down to the nearest integer.
|
||||
///
|
||||
/// If the number is already an integer, it is returned unchanged.
|
||||
///
|
||||
@ -679,7 +679,7 @@ pub fn floor(
|
||||
}
|
||||
}
|
||||
|
||||
/// Round a number up to the nearest integer.
|
||||
/// Rounds a number up to the nearest integer.
|
||||
///
|
||||
/// If the number is already an integer, it is returned unchanged.
|
||||
///
|
||||
@ -729,7 +729,7 @@ pub fn trunc(
|
||||
|
||||
/// Returns the fractional part of a number.
|
||||
///
|
||||
/// If the number is an integer, it returns `0`.
|
||||
/// If the number is an integer, returns `0`.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -750,7 +750,7 @@ pub fn fract(
|
||||
}
|
||||
}
|
||||
|
||||
/// Round a number to the nearest integer.
|
||||
/// Rounds a number to the nearest integer.
|
||||
///
|
||||
/// Optionally, a number of decimal places can be specified.
|
||||
///
|
||||
@ -782,7 +782,7 @@ pub fn round(
|
||||
}
|
||||
}
|
||||
|
||||
/// Clamp a number between a minimum and maximum value.
|
||||
/// Clamps a number between a minimum and maximum value.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -808,7 +808,7 @@ pub fn clamp(
|
||||
Ok(value.apply3(min, max.v, i64::clamp, f64::clamp))
|
||||
}
|
||||
|
||||
/// Determine the minimum of a sequence of values.
|
||||
/// Determines the minimum of a sequence of values.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -830,7 +830,7 @@ pub fn min(
|
||||
minmax(span, values, Ordering::Less)
|
||||
}
|
||||
|
||||
/// Determine the maximum of a sequence of values.
|
||||
/// Determines the maximum of a sequence of values.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -873,7 +873,7 @@ fn minmax(
|
||||
Ok(extremum)
|
||||
}
|
||||
|
||||
/// Determine whether an integer is even.
|
||||
/// Determines whether an integer is even.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -892,7 +892,7 @@ pub fn even(
|
||||
value % 2 == 0
|
||||
}
|
||||
|
||||
/// Determine whether an integer is odd.
|
||||
/// Determines whether an integer is odd.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -911,7 +911,7 @@ pub fn odd(
|
||||
value % 2 != 0
|
||||
}
|
||||
|
||||
/// Calculate the remainder of two numbers.
|
||||
/// Calculates the remainder of two numbers.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -934,7 +934,7 @@ pub fn rem(
|
||||
Ok(dividend.apply2(divisor.v, Rem::rem, Rem::rem))
|
||||
}
|
||||
|
||||
/// Calculate the quotient of two numbers.
|
||||
/// Calculates the quotient of two numbers.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -7,7 +7,7 @@ use typst::eval::{Datetime, Regex};
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Convert a value to an integer.
|
||||
/// Converts a value to an integer.
|
||||
///
|
||||
/// - Booleans are converted to `0` or `1`.
|
||||
/// - Floats are floored to the next 64-bit integer.
|
||||
@ -42,7 +42,7 @@ cast! {
|
||||
v: EcoString => Self(v.parse().map_err(|_| eco_format!("invalid integer: {}", v))?),
|
||||
}
|
||||
|
||||
/// Convert a value to a float.
|
||||
/// Converts a value to a float.
|
||||
///
|
||||
/// - Booleans are converted to `0.0` or `1.0`.
|
||||
/// - Integers are converted to the closest 64-bit float.
|
||||
@ -82,7 +82,7 @@ cast! {
|
||||
v: EcoString => Self(v.parse().map_err(|_| eco_format!("invalid float: {}", v))?),
|
||||
}
|
||||
|
||||
/// Create a grayscale color.
|
||||
/// Creates a grayscale color.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -101,7 +101,7 @@ pub fn luma(
|
||||
LumaColor::new(gray.0).into()
|
||||
}
|
||||
|
||||
/// Create an RGB(A) color.
|
||||
/// Creates an RGB(A) color.
|
||||
///
|
||||
/// The color is specified in the sRGB color space.
|
||||
///
|
||||
@ -180,7 +180,7 @@ cast! {
|
||||
},
|
||||
}
|
||||
|
||||
/// Create a new datetime.
|
||||
/// Creates a new datetime.
|
||||
///
|
||||
/// You can specify the [datetime]($type/datetime) using a year, month, day,
|
||||
/// hour, minute, and second. You can also get the current date with
|
||||
@ -338,7 +338,7 @@ pub fn datetime_today(
|
||||
.ok_or("unable to get the current date")?)
|
||||
}
|
||||
|
||||
/// Create a CMYK color.
|
||||
/// Creates a CMYK color.
|
||||
///
|
||||
/// This is useful if you want to target a specific printer. The conversion
|
||||
/// to RGB for display preview might differ from how your printer reproduces
|
||||
@ -379,7 +379,7 @@ cast! {
|
||||
},
|
||||
}
|
||||
|
||||
/// Create a custom symbol with modifiers.
|
||||
/// Creates a custom symbol with modifiers.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -442,7 +442,7 @@ cast! {
|
||||
},
|
||||
}
|
||||
|
||||
/// Convert a value to a string.
|
||||
/// Converts a value to a string.
|
||||
///
|
||||
/// - Integers are formatted in base 10. This can be overridden with the
|
||||
/// optional `base` parameter.
|
||||
@ -567,7 +567,7 @@ pub fn str_to_unicode(
|
||||
value.into()
|
||||
}
|
||||
|
||||
/// Converts a unicode code point into its corresponding string.
|
||||
/// Converts a Unicode code point into its corresponding string.
|
||||
///
|
||||
/// ```example
|
||||
/// #str.from-unicode(97)
|
||||
@ -595,7 +595,7 @@ cast! {
|
||||
},
|
||||
}
|
||||
|
||||
/// Create a label from a string.
|
||||
/// Creates a label from a string.
|
||||
///
|
||||
/// Inserting a label into content attaches it to the closest previous element
|
||||
/// that is not a space. Then, the element can be [referenced]($func/ref) and
|
||||
@ -624,14 +624,13 @@ pub fn label(
|
||||
Label(name)
|
||||
}
|
||||
|
||||
/// Create a regular expression from a string.
|
||||
/// Creates a regular expression from a string.
|
||||
///
|
||||
/// The result can be used as a
|
||||
/// [show rule selector]($styling/#show-rules) and with
|
||||
/// [string methods]($type/string) like `find`, `split`, and `replace`.
|
||||
///
|
||||
/// [See here](https://docs.rs/regex/latest/regex/#syntax) for a specification
|
||||
/// of the supported syntax.
|
||||
/// See [the specification of the supported syntax](https://docs.rs/regex/latest/regex/#syntax).
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -664,7 +663,7 @@ pub fn regex(
|
||||
Regex::new(®ex.v).at(regex.span)
|
||||
}
|
||||
|
||||
/// Create an array consisting of a sequence of numbers.
|
||||
/// Creates an array consisting of consecutive integers.
|
||||
///
|
||||
/// If you pass just one positional parameter, it is interpreted as the `end` of
|
||||
/// the range. If you pass two, they describe the `start` and `end` of the
|
||||
|
@ -3,7 +3,7 @@ use typst::eval::Datetime;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Read plain text from a file.
|
||||
/// Reads plain text from a file.
|
||||
///
|
||||
/// The file will be read and returned as a string.
|
||||
///
|
||||
@ -33,7 +33,7 @@ pub fn read(
|
||||
Ok(text.into())
|
||||
}
|
||||
|
||||
/// Read structured data from a CSV file.
|
||||
/// Reads structured data from a CSV file.
|
||||
///
|
||||
/// The CSV file will be read and parsed into a 2-dimensional array of strings:
|
||||
/// Each row in the CSV file will be represented as an array of strings, and all
|
||||
@ -129,7 +129,7 @@ fn format_csv_error(error: csv::Error, line: usize) -> EcoString {
|
||||
}
|
||||
}
|
||||
|
||||
/// Read structured data from a JSON file.
|
||||
/// Reads structured data from a JSON file.
|
||||
///
|
||||
/// The file must contain a valid JSON object or array. JSON objects will be
|
||||
/// converted into Typst dictionaries, and JSON arrays will be converted into
|
||||
@ -211,7 +211,7 @@ fn format_json_error(error: serde_json::Error) -> EcoString {
|
||||
eco_format!("failed to parse json file: syntax error in line {}", error.line())
|
||||
}
|
||||
|
||||
/// Read structured data from a TOML file.
|
||||
/// Reads structured data from a TOML file.
|
||||
///
|
||||
/// The file must contain a valid TOML table. TOML tables will be
|
||||
/// converted into Typst dictionaries, and TOML arrays will be converted into
|
||||
@ -304,7 +304,7 @@ fn format_toml_error(error: toml::de::Error) -> EcoString {
|
||||
}
|
||||
}
|
||||
|
||||
/// Read structured data from a YAML file.
|
||||
/// Reads structured data from a YAML file.
|
||||
///
|
||||
/// The file must contain a valid YAML object or array. YAML mappings will be
|
||||
/// converted into Typst dictionaries, and YAML sequences will be converted into
|
||||
@ -396,7 +396,7 @@ fn format_yaml_error(error: serde_yaml::Error) -> EcoString {
|
||||
eco_format!("failed to parse yaml file: {}", error.to_string().trim())
|
||||
}
|
||||
|
||||
/// Read structured data from an XML file.
|
||||
/// Reads structured data from an XML file.
|
||||
///
|
||||
/// The XML file is parsed into an array of dictionaries and strings. XML nodes
|
||||
/// can be elements or strings. Elements are represented as dictionaries with
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Determine a value's type.
|
||||
/// Determines the type of a value.
|
||||
///
|
||||
/// Returns the name of the value's type.
|
||||
///
|
||||
@ -24,7 +24,7 @@ pub fn type_(
|
||||
value.type_name().into()
|
||||
}
|
||||
|
||||
/// The string representation of a value.
|
||||
/// Returns the string representation of a value.
|
||||
///
|
||||
/// When inserted into content, most values are displayed as this representation
|
||||
/// in monospace with syntax-highlighting. The exceptions are `{none}`,
|
||||
@ -51,7 +51,7 @@ pub fn repr(
|
||||
value.repr()
|
||||
}
|
||||
|
||||
/// Fail with an error.
|
||||
/// Fails with an error.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// The code below produces the error `panicked with: "this is wrong"`.
|
||||
@ -80,7 +80,7 @@ pub fn panic(
|
||||
Err(msg)
|
||||
}
|
||||
|
||||
/// Ensure that a condition is fulfilled.
|
||||
/// Ensures that a condition is fulfilled.
|
||||
///
|
||||
/// Fails with an error if the condition is not fulfilled. Does not
|
||||
/// produce any output in the document.
|
||||
@ -118,7 +118,7 @@ pub fn assert(
|
||||
Ok(NoneValue)
|
||||
}
|
||||
|
||||
/// Ensure that two values are equal.
|
||||
/// Ensures that two values are equal.
|
||||
///
|
||||
/// Fails with an error if the first value is not equal to the second. Does not
|
||||
/// produce any output in the document.
|
||||
@ -153,7 +153,7 @@ pub fn assert_eq(
|
||||
Ok(NoneValue)
|
||||
}
|
||||
|
||||
/// Ensure that two values are not equal.
|
||||
/// Ensures that two values are not equal.
|
||||
///
|
||||
/// Fails with an error if the first value is equal to the second. Does not
|
||||
/// produce any output in the document.
|
||||
@ -188,7 +188,7 @@ pub fn assert_ne(
|
||||
Ok(NoneValue)
|
||||
}
|
||||
|
||||
/// Evaluate a string as Typst code.
|
||||
/// Evaluates a string as Typst code.
|
||||
///
|
||||
/// This function should only be used as a last resort.
|
||||
///
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Align content horizontally and vertically.
|
||||
/// Aligns content horizontally and vertically.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -1,7 +1,7 @@
|
||||
use crate::prelude::*;
|
||||
use crate::text::TextElem;
|
||||
|
||||
/// Separate a region into multiple equally sized columns.
|
||||
/// Separates a region into multiple equally sized columns.
|
||||
///
|
||||
/// The `column` function allows to separate the interior of any container into
|
||||
/// multiple columns. It will not equalize the height of the columns, instead,
|
||||
@ -127,7 +127,7 @@ impl Layout for ColumnsElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// A forced column break.
|
||||
/// Forces a column break.
|
||||
///
|
||||
/// The function will behave like a [page break]($func/pagebreak) when used in a
|
||||
/// single column layout or the last column on a page. Otherwise, content after
|
||||
|
@ -169,7 +169,7 @@ impl Layout for BoxElem {
|
||||
|
||||
/// A block-level container.
|
||||
///
|
||||
/// Such a container can be used to separate content, size it and give it a
|
||||
/// Such a container can be used to separate content, size it, and give it a
|
||||
/// background or border.
|
||||
///
|
||||
/// ## Examples { #examples }
|
||||
@ -214,9 +214,9 @@ pub struct BlockElem {
|
||||
/// ```
|
||||
pub width: Smart<Rel<Length>>,
|
||||
|
||||
/// The block's height. When the height is larger than the remaining space on
|
||||
/// a page and [`breakable`]($func/block.breakable) is `{true}`, the block
|
||||
/// will continue on the next page with the remaining height.
|
||||
/// The block's height. When the height is larger than the remaining space
|
||||
/// on a page and [`breakable`]($func/block.breakable) is `{true}`, the
|
||||
/// block will continue on the next page with the remaining height.
|
||||
///
|
||||
/// ```example
|
||||
/// #set page(height: 80pt)
|
||||
|
@ -10,10 +10,10 @@ use crate::visualize::{
|
||||
SquareElem,
|
||||
};
|
||||
|
||||
/// Arrange spacing, paragraphs and block-level elements into a flow.
|
||||
/// Arranges spacing, paragraphs and block-level elements into a flow.
|
||||
///
|
||||
/// This element is responsible for layouting both the top-level content flow and
|
||||
/// the contents of boxes.
|
||||
/// This element is responsible for layouting both the top-level content flow
|
||||
/// and the contents of boxes.
|
||||
///
|
||||
/// Display: Flow
|
||||
/// Category: layout
|
||||
|
@ -3,7 +3,7 @@ use crate::text::TextElem;
|
||||
|
||||
use super::Sizing;
|
||||
|
||||
/// Arrange content in a grid.
|
||||
/// Arranges content in a grid.
|
||||
///
|
||||
/// The grid element allows you to arrange content in a grid. You can define the
|
||||
/// number of rows and columns, as well as the size of the gutters between them.
|
||||
@ -63,7 +63,7 @@ use super::Sizing;
|
||||
/// Category: layout
|
||||
#[element(Layout)]
|
||||
pub struct GridElem {
|
||||
/// Defines the column sizes.
|
||||
/// The column sizes.
|
||||
///
|
||||
/// Either specify a track size array or provide an integer to create a grid
|
||||
/// with that many `{auto}`-sized columns. Note that opposed to rows and
|
||||
@ -71,26 +71,26 @@ pub struct GridElem {
|
||||
/// column.
|
||||
pub columns: TrackSizings,
|
||||
|
||||
/// Defines the row sizes.
|
||||
/// The row sizes.
|
||||
///
|
||||
/// If there are more cells than fit the defined rows, the last row is
|
||||
/// repeated until there are no more cells.
|
||||
pub rows: TrackSizings,
|
||||
|
||||
/// Defines the gaps between rows & columns.
|
||||
/// The gaps between rows & columns.
|
||||
///
|
||||
/// If there are more gutters than defined sizes, the last gutter is repeated.
|
||||
#[external]
|
||||
pub gutter: TrackSizings,
|
||||
|
||||
/// Defines the gaps between columns. Takes precedence over `gutter`.
|
||||
/// The gaps between columns. Takes precedence over `gutter`.
|
||||
#[parse(
|
||||
let gutter = args.named("gutter")?;
|
||||
args.named("column-gutter")?.or_else(|| gutter.clone())
|
||||
)]
|
||||
pub column_gutter: TrackSizings,
|
||||
|
||||
/// Defines the gaps between rows. Takes precedence over `gutter`.
|
||||
/// The gaps between rows. Takes precedence over `gutter`.
|
||||
#[parse(args.named("row-gutter")?.or_else(|| gutter.clone()))]
|
||||
pub row_gutter: TrackSizings,
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Hide content without affecting layout.
|
||||
/// Hides content without affecting layout.
|
||||
///
|
||||
/// The `hide` function allows you to hide content while the layout still 'sees'
|
||||
/// it. This is useful to create whitespace that is exactly as large as some
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Measure the layouted size of content.
|
||||
/// Measures the layouted size of content.
|
||||
///
|
||||
/// The `measure` function lets you determine the layouted size of content.
|
||||
/// Note that an infinite space is assumed, therefore the measured height/width
|
||||
|
@ -1,10 +1,9 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Add spacing around content.
|
||||
/// Adds spacing around content.
|
||||
///
|
||||
/// The `pad` function adds spacing around content. The spacing can be specified
|
||||
/// for each side individually, or for all sides at once by specifying a
|
||||
/// positional argument.
|
||||
/// The spacing can be specified for each side individually, or for all sides at
|
||||
/// once by specifying a positional argument.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -18,7 +18,7 @@ use crate::text::{
|
||||
SpaceElem, TextElem,
|
||||
};
|
||||
|
||||
/// Arrange text, spacing and inline-level elements into a paragraph.
|
||||
/// Arranges text, spacing and inline-level elements into a paragraph.
|
||||
///
|
||||
/// Although this function is primarily used in set rules to affect paragraph
|
||||
/// properties, it can also be used to explicitly render its argument onto a
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Place content at an absolute position.
|
||||
/// Places content at an absolute position.
|
||||
///
|
||||
/// Placed content will not affect the position of other content. Place is
|
||||
/// always relative to its parent container and will be in the foreground of all
|
||||
|
@ -2,7 +2,7 @@ use std::cmp::Ordering;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Insert horizontal spacing into a paragraph.
|
||||
/// Inserts horizontal spacing into a paragraph.
|
||||
///
|
||||
/// The spacing can be absolute, relative, or fractional. In the last case, the
|
||||
/// remaining space on the line is distributed among all fractional spacings
|
||||
@ -27,7 +27,7 @@ pub struct HElem {
|
||||
#[required]
|
||||
pub amount: Spacing,
|
||||
|
||||
/// If true, the spacing collapses at the start or end of a paragraph.
|
||||
/// If `{true}`, the spacing collapses at the start or end of a paragraph.
|
||||
/// Moreover, from multiple adjacent weak spacings all but the largest one
|
||||
/// collapse.
|
||||
///
|
||||
@ -62,7 +62,7 @@ impl Behave for HElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Insert vertical spacing into a flow of blocks.
|
||||
/// Inserts vertical spacing into a flow of blocks.
|
||||
///
|
||||
/// The spacing can be absolute, relative, or fractional. In the last case,
|
||||
/// the remaining space on the page is distributed among all fractional spacings
|
||||
@ -91,10 +91,10 @@ pub struct VElem {
|
||||
#[required]
|
||||
pub amount: Spacing,
|
||||
|
||||
/// 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.
|
||||
/// Weak spacings will always collapse adjacent paragraph spacing, even if the
|
||||
/// paragraph spacing is larger.
|
||||
/// 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. Weak spacings will always collapse adjacent paragraph spacing,
|
||||
/// even if the paragraph spacing is larger.
|
||||
///
|
||||
/// ```example
|
||||
/// The following theorem is
|
||||
@ -107,7 +107,7 @@ pub struct VElem {
|
||||
#[external]
|
||||
pub weak: bool,
|
||||
|
||||
/// The elements's weakness level, see also [`Behaviour`].
|
||||
/// The element's weakness level, see also [`Behaviour`].
|
||||
#[internal]
|
||||
#[parse(args.named("weak")?.map(|v: bool| v as usize))]
|
||||
pub weakness: usize,
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::{AlignElem, Spacing};
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Arrange content and spacing horizontally or vertically.
|
||||
/// Arranges content and spacing horizontally or vertically.
|
||||
///
|
||||
/// The stack places a list of items along an axis, with optional spacing
|
||||
/// between each item.
|
||||
|
@ -39,36 +39,36 @@ use crate::prelude::*;
|
||||
/// Category: layout
|
||||
#[element(Layout, LocalName, Figurable)]
|
||||
pub struct TableElem {
|
||||
/// Defines the column sizes. See the [grid documentation]($func/grid) for
|
||||
/// more information on track sizing.
|
||||
/// The column sizes. See the [grid documentation]($func/grid) for more
|
||||
/// information on track sizing.
|
||||
pub columns: TrackSizings,
|
||||
|
||||
/// Defines the row sizes. See the [grid documentation]($func/grid) for more
|
||||
/// The row sizes. See the [grid documentation]($func/grid) for more
|
||||
/// information on track sizing.
|
||||
pub rows: TrackSizings,
|
||||
|
||||
/// Defines the gaps between rows & columns. See the [grid
|
||||
/// The gaps between rows & columns. See the [grid
|
||||
/// documentation]($func/grid) for more information on gutters.
|
||||
#[external]
|
||||
pub gutter: TrackSizings,
|
||||
|
||||
/// Defines the gaps between columns. Takes precedence over `gutter`. See
|
||||
/// the [grid documentation]($func/grid) for more information on gutters.
|
||||
/// The gaps between columns. Takes precedence over `gutter`. See the [grid
|
||||
/// documentation]($func/grid) for more information on gutters.
|
||||
#[parse(
|
||||
let gutter = args.named("gutter")?;
|
||||
args.named("column-gutter")?.or_else(|| gutter.clone())
|
||||
)]
|
||||
pub column_gutter: TrackSizings,
|
||||
|
||||
/// Defines the gaps between rows. Takes precedence over `gutter`. See the
|
||||
/// [grid documentation]($func/grid) for more information on gutters.
|
||||
/// The gaps between rows. Takes precedence over `gutter`. See the [grid
|
||||
/// documentation]($func/grid) for more information on gutters.
|
||||
#[parse(args.named("row-gutter")?.or_else(|| gutter.clone()))]
|
||||
pub row_gutter: TrackSizings,
|
||||
|
||||
/// How to fill the cells.
|
||||
///
|
||||
/// This can be a color or a function that returns a color. The function is
|
||||
/// passed the cell's column and row index, starting at zero. This can be
|
||||
/// passed the cells' column and row index, starting at zero. This can be
|
||||
/// used to implement striped tables.
|
||||
///
|
||||
/// ```example
|
||||
@ -87,11 +87,11 @@ pub struct TableElem {
|
||||
/// ```
|
||||
pub fill: Celled<Option<Paint>>,
|
||||
|
||||
/// How to align the cell's content.
|
||||
/// How to align the cells' content.
|
||||
///
|
||||
/// This can either be a single alignment, an array of alignments
|
||||
/// (corresponding to each column) or a function that returns an alignment.
|
||||
/// The function is passed the cell's column and row index, starting at zero.
|
||||
/// The function is passed the cells' column and row index, starting at zero.
|
||||
/// If set to `{auto}`, the outer alignment is used.
|
||||
///
|
||||
/// ```example
|
||||
@ -117,7 +117,7 @@ pub struct TableElem {
|
||||
#[default(Some(PartialStroke::default()))]
|
||||
pub stroke: Option<PartialStroke>,
|
||||
|
||||
/// How much to pad the cells's content.
|
||||
/// How much to pad the cells' content.
|
||||
#[default(Abs::pt(5.0).into())]
|
||||
pub inset: Rel<Length>,
|
||||
|
||||
|
@ -2,11 +2,11 @@ use typst::geom::Transform;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Move content without affecting layout.
|
||||
/// Moves content without affecting layout.
|
||||
///
|
||||
/// The `move` function allows you to move content while the layout still 'sees'
|
||||
/// it at the original positions. Containers will still be sized as if the content
|
||||
/// was not moved.
|
||||
/// it at the original positions. Containers will still be sized as if the
|
||||
/// content was not moved.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -53,9 +53,9 @@ impl Layout for MoveElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Rotate content without affecting layout.
|
||||
/// Rotates content without affecting layout.
|
||||
///
|
||||
/// Rotate an element by a given angle. The layout will act as if the element
|
||||
/// Rotates an element by a given angle. The layout will act as if the element
|
||||
/// was not rotated.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
@ -126,11 +126,9 @@ impl Layout for RotateElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Scale content without affecting layout.
|
||||
///
|
||||
/// The `scale` function allows you to scale and mirror content without
|
||||
/// affecting the layout.
|
||||
/// Scales content without affecting layout.
|
||||
///
|
||||
/// Lets you mirror content by specifying a negative scale on a single axis.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -3,7 +3,7 @@ use super::*;
|
||||
/// How much the accent can be shorter than the base.
|
||||
const ACCENT_SHORT_FALL: Em = Em::new(0.5);
|
||||
|
||||
/// Attach an accent to a base.
|
||||
/// Attaches an accent to a base.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -84,7 +84,7 @@ impl LayoutMath for AttachElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Force a base to display attachments as scripts.
|
||||
/// Forces a base to display attachments as scripts.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -110,7 +110,7 @@ impl LayoutMath for ScriptsElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Force a base to display attachments as limits.
|
||||
/// Forces a base to display attachments as limits.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -2,7 +2,7 @@ use super::*;
|
||||
|
||||
/// Displays a diagonal line over a part of an equation.
|
||||
///
|
||||
/// This is commonly used to show the eliminiation of a term.
|
||||
/// This is commonly used to show the elimination of a term.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -53,8 +53,8 @@ pub struct CancelElem {
|
||||
#[default(false)]
|
||||
pub cross: bool,
|
||||
|
||||
/// Rotate the cancel line by a certain angle. See the
|
||||
/// [line's documentation]($func/line.angle) for more details.
|
||||
/// How to rotate the cancel line. See the [line's
|
||||
/// documentation]($func/line.angle) for more details.
|
||||
///
|
||||
/// ```example
|
||||
/// >>> #set page(width: 140pt)
|
||||
|
@ -104,7 +104,7 @@ fn scale(
|
||||
}
|
||||
}
|
||||
|
||||
/// Floor an expression.
|
||||
/// Floors an expression.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -121,7 +121,7 @@ pub fn floor(
|
||||
delimited(body, '⌊', '⌋')
|
||||
}
|
||||
|
||||
/// Ceil an expression.
|
||||
/// Ceils an expression.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -138,7 +138,7 @@ pub fn ceil(
|
||||
delimited(body, '⌈', '⌉')
|
||||
}
|
||||
|
||||
/// Round an expression.
|
||||
/// Rounds an expression.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -155,7 +155,7 @@ pub fn round(
|
||||
delimited(body, '⌊', '⌉')
|
||||
}
|
||||
|
||||
/// Take the absolute value of an expression.
|
||||
/// Takes the absolute value of an expression.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -173,7 +173,7 @@ pub fn abs(
|
||||
delimited(body, '|', '|')
|
||||
}
|
||||
|
||||
/// Take the norm of an expression.
|
||||
/// Takes the norm of an expression.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -153,11 +153,11 @@ pub fn bb(
|
||||
|
||||
/// Forced display style in math.
|
||||
///
|
||||
/// This is the normal size for display equations.
|
||||
/// This is the normal size for block equations.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
/// $sum_i x_i/2 = display(sum_i x/2)$
|
||||
/// $sum_i x_i/2 = display(sum_i x_i/2)$
|
||||
/// ```
|
||||
///
|
||||
/// Display: Display Size
|
||||
|
@ -15,7 +15,7 @@ use crate::prelude::*;
|
||||
///
|
||||
/// ## Methods
|
||||
/// ### page()
|
||||
/// Return the page number for this location.
|
||||
/// Returns the page number for this location.
|
||||
///
|
||||
/// Note that this does not return the value of the [page counter]($func/counter)
|
||||
/// at this location, but the true page number (starting from one).
|
||||
@ -26,7 +26,7 @@ use crate::prelude::*;
|
||||
/// - returns: integer
|
||||
///
|
||||
/// ### position()
|
||||
/// Return a dictionary with the page number and the x, y position for this
|
||||
/// Returns a dictionary with the page number and the x, y position for this
|
||||
/// location. The page number starts at one and the coordinates are measured
|
||||
/// from the top-left of the page.
|
||||
///
|
||||
|
@ -11,7 +11,7 @@ use crate::layout::PageElem;
|
||||
use crate::math::EquationElem;
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Count through pages, elements, and more.
|
||||
/// Counts through pages, elements, and more.
|
||||
///
|
||||
/// With the counter function, you can access and modify counters for pages,
|
||||
/// headings, figures, and more. Moreover, you can define custom counters for
|
||||
@ -23,9 +23,9 @@ use crate::prelude::*;
|
||||
/// on the counter. To see any output, you also have to enable heading
|
||||
/// [numbering]($func/heading.numbering).
|
||||
///
|
||||
/// The display function optionally takes an argument telling it how to
|
||||
/// format the counter. This can be a
|
||||
/// [numbering pattern or a function]($func/numbering).
|
||||
/// The `display` method optionally takes an argument telling it how to format
|
||||
/// the counter. This can be a [numbering pattern or a
|
||||
/// function]($func/numbering).
|
||||
///
|
||||
/// ```example
|
||||
/// #set heading(numbering: "1.")
|
||||
@ -203,7 +203,7 @@ use crate::prelude::*;
|
||||
///
|
||||
/// ## Methods
|
||||
/// ### display()
|
||||
/// Display the value of the counter.
|
||||
/// Displays the value of the counter.
|
||||
///
|
||||
/// - numbering: string or function (positional)
|
||||
/// A [numbering pattern or a function]($func/numbering), which specifies how
|
||||
@ -224,7 +224,7 @@ use crate::prelude::*;
|
||||
/// - returns: content
|
||||
///
|
||||
/// ### step()
|
||||
/// Increase the value of the counter by one.
|
||||
/// Increases the value of the counter by one.
|
||||
///
|
||||
/// The update will be in effect at the position where the returned content is
|
||||
/// inserted into the document. If you don't put the output into the document,
|
||||
@ -238,7 +238,7 @@ use crate::prelude::*;
|
||||
/// - returns: content
|
||||
///
|
||||
/// ### update()
|
||||
/// Update the value of the counter.
|
||||
/// Updates the value of the counter.
|
||||
///
|
||||
/// Just like with `step`, the update only occurs if you put the resulting
|
||||
/// content into the document.
|
||||
@ -252,7 +252,7 @@ use crate::prelude::*;
|
||||
/// - returns: content
|
||||
///
|
||||
/// ### at()
|
||||
/// Get the value of the counter at the given location. Always returns an
|
||||
/// Gets the value of the counter at the given location. Always returns an
|
||||
/// array of integers, even if the counter has just one number.
|
||||
///
|
||||
/// - location: location (positional, required)
|
||||
@ -263,7 +263,7 @@ use crate::prelude::*;
|
||||
/// - returns: array
|
||||
///
|
||||
/// ### final()
|
||||
/// Get the value of the counter at the end of the document. Always returns an
|
||||
/// Gets the value of the counter at the end of the document. Always returns an
|
||||
/// array of integers, even if the counter has just one number.
|
||||
///
|
||||
/// - location: location (positional, required)
|
||||
|
@ -1,12 +1,10 @@
|
||||
use crate::prelude::*;
|
||||
use crate::text::{Hyphenate, TextElem};
|
||||
|
||||
/// Link to a URL or a location in the document.
|
||||
/// Links to a URL or a location in the document.
|
||||
///
|
||||
/// The link function makes its positional `body` argument clickable and links
|
||||
/// it to the destination specified by the `dest` argument. By default, links
|
||||
/// are not styled any different from normal text. However, you can easily apply
|
||||
/// a style of your choice with a show rule.
|
||||
/// By default, links are not styled any different from normal text. However,
|
||||
/// you can easily apply a style of your choice with a show rule.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -6,7 +6,7 @@ use ecow::EcoVec;
|
||||
use crate::prelude::*;
|
||||
use crate::text::Case;
|
||||
|
||||
/// Apply a numbering to a sequence of numbers.
|
||||
/// Applies a numbering to a sequence of numbers.
|
||||
///
|
||||
/// A numbering defines how a sequence of numbers should be displayed as
|
||||
/// content. It is defined either through a pattern string or an arbitrary
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Find elements in the document.
|
||||
/// Finds elements in the document.
|
||||
///
|
||||
/// The `query` functions lets you search your document for elements of a
|
||||
/// particular type or with a particular label.
|
||||
|
@ -6,11 +6,11 @@ use crate::text::TextElem;
|
||||
|
||||
/// A reference to a label or bibliography.
|
||||
///
|
||||
/// The reference function produces a textual reference to a label. For example,
|
||||
/// a reference to a heading will yield an appropriate string such as "Section
|
||||
/// 1" for a reference to the first heading. The references are also links to
|
||||
/// the respective element. Reference syntax can also be used to
|
||||
/// [cite]($func/cite) from a bibliography.
|
||||
/// Produces a textual reference to a label. For example, a reference to a
|
||||
/// heading will yield an appropriate string such as "Section 1" for a reference
|
||||
/// to the first heading. The references are also links to the respective
|
||||
/// element. Reference syntax can also be used to [cite]($func/cite) from a
|
||||
/// bibliography.
|
||||
///
|
||||
/// Referenceable elements include [headings]($func/heading),
|
||||
/// [figures]($func/figure), and [equations]($func/math.equation). To create a
|
||||
|
@ -6,14 +6,14 @@ use typst::model::DelayedErrors;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Manage stateful parts of your document.
|
||||
/// Manages stateful parts of your document.
|
||||
///
|
||||
/// Let's say you have some computations in your document and want to remember
|
||||
/// the result of your last computation to use it in the next one. You might try
|
||||
/// something similar the code below and would expect it to output 10, 13, 26,
|
||||
/// and 21. However this **does not work** in Typst. If you test this code, you
|
||||
/// will see that Typst complains with the following error message: _Variables
|
||||
/// from outside the function are read-only and cannot be modified._
|
||||
/// something similar to the code below and expect it to output 10, 13, 26, and
|
||||
/// 21. However this **does not work** in Typst. If you test this code, you will
|
||||
/// see that Typst complains with the following error message: _Variables from
|
||||
/// outside the function are read-only and cannot be modified._
|
||||
///
|
||||
/// ```typ
|
||||
/// #let x = 0
|
||||
@ -177,13 +177,13 @@ use crate::prelude::*;
|
||||
/// ```
|
||||
///
|
||||
/// In general, you should _typically_ not generate state updates from within
|
||||
/// `locate` calls or `display` calls of state or counters. Instead pass a
|
||||
/// `locate` calls or `display` calls of state or counters. Instead, pass a
|
||||
/// function to `update` that determines the value of the state based on its
|
||||
/// previous value.
|
||||
///
|
||||
/// ## Methods
|
||||
/// ### display()
|
||||
/// Display the value of the state.
|
||||
/// Displays the value of the state.
|
||||
///
|
||||
/// - format: function (positional)
|
||||
/// A function which receives the value of the state and can return arbitrary
|
||||
@ -193,7 +193,7 @@ use crate::prelude::*;
|
||||
/// - returns: content
|
||||
///
|
||||
/// ### update()
|
||||
/// Update the value of the state.
|
||||
/// Updates the value of the state.
|
||||
///
|
||||
/// The update will be in effect at the position where the returned content is
|
||||
/// inserted into the document. If you don't put the output into the document,
|
||||
@ -209,7 +209,7 @@ use crate::prelude::*;
|
||||
/// - returns: content
|
||||
///
|
||||
/// ### at()
|
||||
/// Get the value of the state at the given location.
|
||||
/// Gets the value of the state at the given location.
|
||||
///
|
||||
/// - location: location (positional, required)
|
||||
/// The location at which the state's value should be retrieved. A suitable
|
||||
@ -219,7 +219,7 @@ use crate::prelude::*;
|
||||
/// - returns: any
|
||||
///
|
||||
/// ### final()
|
||||
/// Get the value of the state at the end of the document.
|
||||
/// Gets the value of the state at the end of the document.
|
||||
///
|
||||
/// - location: location (positional, required)
|
||||
/// Can be any location. Why is it required then? As noted before, Typst has
|
||||
|
@ -4,7 +4,7 @@ use ttf_parser::{GlyphId, OutlineBuilder};
|
||||
use super::TextElem;
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Underline text.
|
||||
/// Underlines text.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -32,8 +32,8 @@ pub struct UnderlineElem {
|
||||
#[fold]
|
||||
pub stroke: Smart<PartialStroke>,
|
||||
|
||||
/// Position of the line relative to the baseline, read from the font tables
|
||||
/// if `{auto}`.
|
||||
/// The position of the line relative to the baseline, read from the font
|
||||
/// tables if `{auto}`.
|
||||
///
|
||||
/// ```example
|
||||
/// #underline(offset: 5pt)[
|
||||
@ -43,7 +43,8 @@ pub struct UnderlineElem {
|
||||
#[resolve]
|
||||
pub offset: Smart<Length>,
|
||||
|
||||
/// Amount that the line will be longer or shorter than its associated text.
|
||||
/// The amount by which to extend the line beyond (or within if negative)
|
||||
/// the content.
|
||||
///
|
||||
/// ```example
|
||||
/// #align(center,
|
||||
@ -81,7 +82,7 @@ impl Show for UnderlineElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add a line over text.
|
||||
/// Adds a line over text.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -110,8 +111,8 @@ pub struct OverlineElem {
|
||||
#[fold]
|
||||
pub stroke: Smart<PartialStroke>,
|
||||
|
||||
/// Position of the line relative to the baseline, read from the font tables
|
||||
/// if `{auto}`.
|
||||
/// The position of the line relative to the baseline. Read from the font
|
||||
/// tables if `{auto}`.
|
||||
///
|
||||
/// ```example
|
||||
/// #overline(offset: -1.2em)[
|
||||
@ -121,7 +122,8 @@ pub struct OverlineElem {
|
||||
#[resolve]
|
||||
pub offset: Smart<Length>,
|
||||
|
||||
/// Amount that the line will be longer or shorter than its associated text.
|
||||
/// The amount by which to extend the line beyond (or within if negative)
|
||||
/// the content.
|
||||
///
|
||||
/// ```example
|
||||
/// #set overline(extent: 4pt)
|
||||
@ -164,7 +166,7 @@ impl Show for OverlineElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Strike through text.
|
||||
/// Strikes through text.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -192,8 +194,8 @@ pub struct StrikeElem {
|
||||
#[fold]
|
||||
pub stroke: Smart<PartialStroke>,
|
||||
|
||||
/// Position of the line relative to the baseline, read from the font tables
|
||||
/// if `{auto}`.
|
||||
/// The position of the line relative to the baseline. Read from the font
|
||||
/// tables if `{auto}`.
|
||||
///
|
||||
/// This is useful if you are unhappy with the offset your font provides.
|
||||
///
|
||||
@ -205,7 +207,8 @@ pub struct StrikeElem {
|
||||
#[resolve]
|
||||
pub offset: Smart<Length>,
|
||||
|
||||
/// Amount that the line will be longer or shorter than its associated text.
|
||||
/// The amount by which to extend the line beyond (or within if negative)
|
||||
/// the content.
|
||||
///
|
||||
/// ```example
|
||||
/// This #strike(extent: -2pt)[skips] parts of the word.
|
||||
|
@ -187,7 +187,7 @@ impl Fold for Toggle {
|
||||
}
|
||||
}
|
||||
|
||||
/// Convert text or content to lowercase.
|
||||
/// Converts text or content to lowercase.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -206,7 +206,7 @@ pub fn lower(
|
||||
case(text, Case::Lower)
|
||||
}
|
||||
|
||||
/// Convert text or content to uppercase.
|
||||
/// Converts text or content to uppercase.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
@ -270,7 +270,7 @@ impl Case {
|
||||
}
|
||||
}
|
||||
|
||||
/// Display text in small capitals.
|
||||
/// Displays text in small capitals.
|
||||
///
|
||||
/// _Note:_ This enables the OpenType `smcp` feature for the font. Not all fonts
|
||||
/// support this feature. Sometimes smallcaps are part of a dedicated font and
|
||||
@ -303,7 +303,7 @@ pub fn smallcaps(
|
||||
body.styled(TextElem::set_smallcaps(true))
|
||||
}
|
||||
|
||||
/// Create blind text.
|
||||
/// Creates 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
|
||||
|
@ -39,11 +39,11 @@ pub(super) fn define(global: &mut Scope) {
|
||||
global.define("lorem", lorem_func());
|
||||
}
|
||||
|
||||
/// Customize the look and layout of text in a variety of ways.
|
||||
/// Customizes the look and layout of text in a variety of ways.
|
||||
///
|
||||
/// This function is used often, both with set rules and directly. While the set
|
||||
/// rule is often the simpler choice, calling the text function directly can be
|
||||
/// useful when passing text as an argument to another function.
|
||||
/// This function is used frequently, both with set rules and directly. While
|
||||
/// the set rule is often the simpler choice, calling the `text` function
|
||||
/// directly can be useful when passing text as an argument to another function.
|
||||
///
|
||||
/// ## Example { #example }
|
||||
/// ```example
|
||||
|
@ -1,7 +1,7 @@
|
||||
use super::{variant, SpaceElem, TextElem, TextSize};
|
||||
use crate::prelude::*;
|
||||
|
||||
/// Set text in subscript.
|
||||
/// Renders text in subscript.
|
||||
///
|
||||
/// The text is rendered smaller and its baseline is lowered.
|
||||
///
|
||||
@ -64,7 +64,7 @@ impl Show for SubElem {
|
||||
}
|
||||
}
|
||||
|
||||
/// Set text in superscript.
|
||||
/// Renders text in superscript.
|
||||
///
|
||||
/// The text is rendered smaller and its baseline is raised.
|
||||
///
|
||||
|
@ -203,7 +203,7 @@ impl Lexer<'_> {
|
||||
if self.s.eat_if("u{") {
|
||||
let hex = self.s.eat_while(char::is_ascii_alphanumeric);
|
||||
if !self.s.eat_if('}') {
|
||||
return self.error("unclosed unicode escape sequence");
|
||||
return self.error("unclosed Unicode escape sequence");
|
||||
}
|
||||
|
||||
if u32::from_str_radix(hex, 16)
|
||||
@ -211,7 +211,7 @@ impl Lexer<'_> {
|
||||
.and_then(std::char::from_u32)
|
||||
.is_none()
|
||||
{
|
||||
return self.error(eco_format!("invalid unicode codepoint: {}", hex));
|
||||
return self.error(eco_format!("invalid Unicode codepoint: {}", hex));
|
||||
}
|
||||
|
||||
return SyntaxKind::Escape;
|
||||
|
@ -27,10 +27,10 @@ let f() , ; : | + - /= == 12 "string"
|
||||
|
||||
---
|
||||
// Unicode codepoint does not exist.
|
||||
// Error: 1-11 invalid unicode codepoint: FFFFFF
|
||||
// Error: 1-11 invalid Unicode codepoint: FFFFFF
|
||||
\u{FFFFFF}
|
||||
|
||||
---
|
||||
// Unterminated.
|
||||
// Error: 1-6 unclosed unicode escape sequence
|
||||
// Error: 1-6 unclosed Unicode escape sequence
|
||||
\u{41[*Bold*]
|
||||
|
Loading…
x
Reference in New Issue
Block a user