Hi,
I have created a function that I call and it works.
Now I want to create a function that takes an argument a vec of some data like this :
(
(
key1:"value1",
key2:"value2",
...
),
//...
)
And then use typst code like that :
// Define a function
#let display_content(data) = [
#table(
columns: (2fr, 1fr, 2fr, 1fr),
align: left,
..for elem in #data{
(table.cell(elem.key1),
table.cell(elem.key2),
// ...
)
}
)
]
// Then call the function in a for
#for elem in my_content {
[#call_other_function[#elem.title]] // title is a string
[#display_content[#elem.data]] // data is a vec like in the beginning of the example.
}
But as I take my precedent function and just add a parameter, I think the problem comes with this line :
..for elem in #data{
I got this error using a typst-as-lib in rust :
TypstSource(
[
SourceDiagnostic {
severity: Error,
span: Span(
323974196639343,
),
message: "expected expression",
trace: [],
hints: [],
},
SourceDiagnostic {
severity: Error,
span: Span(
323974717241437,
),
message: "the character `#` is not valid in code",
trace: [],
hints: [],
},
SourceDiagnostic {
severity: Error,
span: Span(
323974849457841,
),
message: "expected comma",
trace: [],
hints: [],
},
],
),
As I am a beginner in typst, I try a lot of thing but really I am lost now…