Rename length to size in square()

This commit is contained in:
Laurenz 2021-10-05 19:46:40 +02:00
parent ae05dc0876
commit 25b053ed93
3 changed files with 6 additions and 6 deletions

View File

@ -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 {

View File

@ -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"))

View File

@ -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)