mirror of
https://github.com/typst/typst
synced 2025-05-13 20:46:23 +08:00
Rename the create
category to construct
This commit is contained in:
parent
1eda162867
commit
4c92ab4ace
@ -24,7 +24,7 @@ use crate::prelude::*;
|
|||||||
/// The value that should be converted to an integer.
|
/// The value that should be converted to an integer.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn int(args: &mut Args) -> SourceResult<Value> {
|
pub fn int(args: &mut Args) -> SourceResult<Value> {
|
||||||
Ok(Value::Int(args.expect::<ToInt>("value")?.0))
|
Ok(Value::Int(args.expect::<ToInt>("value")?.0))
|
||||||
@ -63,7 +63,7 @@ castable! {
|
|||||||
/// The value that should be converted to a float.
|
/// The value that should be converted to a float.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn float(args: &mut Args) -> SourceResult<Value> {
|
pub fn float(args: &mut Args) -> SourceResult<Value> {
|
||||||
Ok(Value::Float(args.expect::<ToFloat>("value")?.0))
|
Ok(Value::Float(args.expect::<ToFloat>("value")?.0))
|
||||||
@ -95,7 +95,7 @@ castable! {
|
|||||||
/// The gray component.
|
/// The gray component.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn luma(args: &mut Args) -> SourceResult<Value> {
|
pub fn luma(args: &mut Args) -> SourceResult<Value> {
|
||||||
let Component(luma) = args.expect("gray component")?;
|
let Component(luma) = args.expect("gray component")?;
|
||||||
@ -147,7 +147,7 @@ pub fn luma(args: &mut Args) -> SourceResult<Value> {
|
|||||||
/// The alpha component.
|
/// The alpha component.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn rgb(args: &mut Args) -> SourceResult<Value> {
|
pub fn rgb(args: &mut Args) -> SourceResult<Value> {
|
||||||
Ok(Value::Color(if let Some(string) = args.find::<Spanned<EcoString>>()? {
|
Ok(Value::Color(if let Some(string) = args.find::<Spanned<EcoString>>()? {
|
||||||
@ -208,7 +208,7 @@ castable! {
|
|||||||
/// The key component.
|
/// The key component.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn cmyk(args: &mut Args) -> SourceResult<Value> {
|
pub fn cmyk(args: &mut Args) -> SourceResult<Value> {
|
||||||
let RatioComponent(c) = args.expect("cyan component")?;
|
let RatioComponent(c) = args.expect("cyan component")?;
|
||||||
@ -250,7 +250,7 @@ castable! {
|
|||||||
/// The value that should be converted to a string.
|
/// The value that should be converted to a string.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn str(args: &mut Args) -> SourceResult<Value> {
|
pub fn str(args: &mut Args) -> SourceResult<Value> {
|
||||||
Ok(Value::Str(args.expect::<ToStr>("value")?.0))
|
Ok(Value::Str(args.expect::<ToStr>("value")?.0))
|
||||||
@ -292,7 +292,7 @@ castable! {
|
|||||||
/// The name of the label.
|
/// The name of the label.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn label(args: &mut Args) -> SourceResult<Value> {
|
pub fn label(args: &mut Args) -> SourceResult<Value> {
|
||||||
Ok(Value::Label(Label(args.expect("string")?)))
|
Ok(Value::Label(Label(args.expect("string")?)))
|
||||||
@ -331,7 +331,7 @@ pub fn label(args: &mut Args) -> SourceResult<Value> {
|
|||||||
/// backslash, you would need to write `{regex("\\\\")}`.
|
/// backslash, you would need to write `{regex("\\\\")}`.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn regex(args: &mut Args) -> SourceResult<Value> {
|
pub fn regex(args: &mut Args) -> SourceResult<Value> {
|
||||||
let Spanned { v, span } = args.expect::<Spanned<EcoString>>("regular expression")?;
|
let Spanned { v, span } = args.expect::<Spanned<EcoString>>("regular expression")?;
|
||||||
@ -365,7 +365,7 @@ pub fn regex(args: &mut Args) -> SourceResult<Value> {
|
|||||||
/// The distance between the generated numbers.
|
/// The distance between the generated numbers.
|
||||||
///
|
///
|
||||||
/// ## Category
|
/// ## Category
|
||||||
/// create
|
/// construct
|
||||||
#[func]
|
#[func]
|
||||||
pub fn range(args: &mut Args) -> SourceResult<Value> {
|
pub fn range(args: &mut Args) -> SourceResult<Value> {
|
||||||
let first = args.expect::<i64>("end")?;
|
let first = args.expect::<i64>("end")?;
|
@ -1,13 +1,13 @@
|
|||||||
//! Computational functions.
|
//! Computational functions.
|
||||||
|
|
||||||
mod calc;
|
mod calc;
|
||||||
mod create;
|
mod construct;
|
||||||
mod data;
|
mod data;
|
||||||
mod foundations;
|
mod foundations;
|
||||||
mod utility;
|
mod utility;
|
||||||
|
|
||||||
pub use self::calc::*;
|
pub use self::calc::*;
|
||||||
pub use self::create::*;
|
pub use self::construct::*;
|
||||||
pub use self::data::*;
|
pub use self::data::*;
|
||||||
pub use self::foundations::*;
|
pub use self::foundations::*;
|
||||||
pub use self::utility::*;
|
pub use self::utility::*;
|
||||||
|
Before Width: | Height: | Size: 155 B After Width: | Height: | Size: 155 B |
Loading…
x
Reference in New Issue
Block a user