Open duskmoon314 opened 4 months ago
A workaround seems to add an empty string to the sequence: ("xxx", "")
Very brief research shows that this query's output gives only authors: "duskmoon"
instead of sequence. Then the error occurs at serde_json::from_value
Update: This is a typst
query feature (I assume this is intended).
For metadata
like this:
#metadata((
authors: ("foo")
)) <meta>
#context {
query(<meta>).first().value
}
The value we get is (authors: "foo")
instead of (authors: ("foo"))
.
But if we have more than one string:
#metadata((
authors: ("foo", "bar")
)) <meta>
#context {
query(<meta>).first().value
}
We get (authors: ("foo", "bar"))
We might need to use enum Author{ Single(String), Multiple(Vec<String>) }
to support only one author. Though, I haven't tried this myself.
It could be improved and you can try ("duskmoon",)
, the array containing single element, as well.
Thanks!
I want to keep this issue open for future improvement, though it is not urgent, and we may leave it as it is.
When I pass a sequence with only one string to
book-meta.authors
, an error occurs.The error:
typst-book
version: v0.1.4