mirror of
https://github.com/typst/typst
synced 2025-05-21 04:25:28 +08:00
Don't type check matrices (#1442)
This commit is contained in:
parent
f62f7624a6
commit
61effc350a
@ -93,15 +93,15 @@ pub struct MatElem {
|
||||
let mut width = 0;
|
||||
|
||||
let values = args.all::<Spanned<Value>>()?;
|
||||
if values.iter().all(|spanned| matches!(spanned.v, Value::Content(_))) {
|
||||
rows = vec![values.into_iter().map(|spanned| spanned.v.display()).collect()];
|
||||
} else {
|
||||
if values.iter().any(|spanned| matches!(spanned.v, Value::Array(_))) {
|
||||
for Spanned { v, span } in values {
|
||||
let array = v.cast::<Array>().at(span)?;
|
||||
let row: Vec<_> = array.into_iter().map(Value::display).collect();
|
||||
width = width.max(row.len());
|
||||
rows.push(row);
|
||||
}
|
||||
} else {
|
||||
rows = vec![values.into_iter().map(|spanned| spanned.v.display()).collect()];
|
||||
}
|
||||
|
||||
for row in &mut rows {
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 25 KiB |
@ -57,3 +57,9 @@ $ a + mat(delim: #none, 1, 2; 3, 4) + b $
|
||||
---
|
||||
// Error: 13-14 expected array, found content
|
||||
$ mat(1, 2; 3, 4, delim: "[") $,
|
||||
|
||||
---
|
||||
$ mat(B, A B) $
|
||||
$ mat(B, A B, dots) $
|
||||
$ mat(B, A B, dots;) $
|
||||
$ mat(#1, #(foo: "bar")) $
|
||||
|
Loading…
x
Reference in New Issue
Block a user