mirror of
https://github.com/typst/typst
synced 2025-05-14 04:56:26 +08:00
Rename length
to size
in square()
This commit is contained in:
parent
ae05dc0876
commit
25b053ed93
@ -41,9 +41,9 @@ pub fn rect(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
|
||||
|
||||
/// `square`: A square with optional content.
|
||||
pub fn square(_: &mut EvalContext, args: &mut Args) -> TypResult<Value> {
|
||||
let length = args.named::<Length>("length")?.map(Linear::from);
|
||||
let width = match length {
|
||||
Some(length) => Some(length),
|
||||
let size = args.named::<Length>("size")?.map(Linear::from);
|
||||
let width = match size {
|
||||
Some(size) => Some(size),
|
||||
None => args.named("width")?,
|
||||
};
|
||||
let height = match width {
|
||||
|
@ -29,6 +29,6 @@
|
||||
]
|
||||
|
||||
---
|
||||
// Length wins over width and height.
|
||||
// Size wins over width and height.
|
||||
// Error: 09-20 unexpected argument
|
||||
#square(width: 10cm, height: 20cm, length: 1cm, fill: rgb("eb5278"))
|
||||
#square(width: 10cm, height: 20cm, size: 1cm, fill: rgb("eb5278"))
|
||||
|
@ -28,7 +28,7 @@
|
||||
#page(width: 50pt, margins: 0pt)
|
||||
#par(spacing: 5pt)
|
||||
|
||||
#let x = square(length: 10pt, fill: eastern)
|
||||
#let x = square(size: 10pt, fill: eastern)
|
||||
#stack(dir: rtl, spacing: 5pt, x, x, x)
|
||||
#stack(dir: ltr, x, 20%, x, 20%, x)
|
||||
#stack(dir: ltr, spacing: 5pt, x, x, 7pt, 3pt, x)
|
||||
|
Loading…
x
Reference in New Issue
Block a user