make typst 0.13 compatible
Typst 0.13 will remove some symbols and make type and str incompatible. Adjust the relevant places in the code to be compatible with those changes.
Fixes: #27 Fixes: #28
With this branch, I still got the following error:
error: cannot apply 'in' to string and none
┌─ @local/metro:0.3.1/src/impl/unit.typ:116:15
│
116 │ let out = if "body" in input {
│ ^^^^^^^^^^^^^^^
help: error occurred in this call of function `display`
┌─ @local/metro:0.3.1/src/impl/unit.typ:242:4
│
242 │ display(options, parse(options, input))
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: error occurred in this call of function `unit`
┌─ @local/metro:0.3.1/src/impl/qty.typ:25:12
│
25 │ let u = unit_(
│ ╭─────────────^
26 │ │ unit,
27 │ │ options
28 │ │ )
│ ╰─────^
help: error occurred in this call of function `qty`
┌─ @local/metro:0.3.1/src/metro.typ:85:9
│
85 │ return impl.qty(
│ ╭──────────^
86 │ │ number,
87 │ │ units,
88 │ │ e: e,
· │
91 │ │ combine-dict(options.named(), _state.get())
92 │ │ )
│ ╰───^
I fixed it via this patch and it seems to work fine hten, but it feels rather ad-hoc:
diff --git a/src/impl/unit.typ b/src/impl/unit.typ
index 385fde1..30ee6df 100644
--- a/src/impl/unit.typ
+++ b/src/impl/unit.typ
@@ -110,6 +110,7 @@
}
#let display(options, input) = {
+ let input = if input == none { (:) } else { input }
let quantity-product = options.quantity-product
options.quantity-product = none
display = display.with(options)
EDIT: Ah, but this only happens for
#qty(5, "%")
for me, maybe that was only accidentally supported previously either way.
Should be noted that this is not enough to make it working with typst 0.13. Found another big regression that basically all units containing more than a single unit are broken
Edit: pushed an update fixing that. Everything seems okay for now, not sure if more might be broken
@amesgen Could you check if you still have the problem? Might have been part of that regression that I found with the math parsing. At least, I can't reproduce your problem with the fix applied.
@fenjalien Any chance of merging this so we don't have to rely on local packages?
@amesgen Could you check if you still have the problem? Might have been part of that regression that I found with the math parsing. At least, I can't reproduce your problem with the fix applied.
Indeed, can confirm that everything now works nicely with the branch from this PR :+1: Thanks!
@fenjalien Bumping the request to merge this PR so local packages aren't necessary with 0.13
@fenjalien This fix also does work for me; a merge would really be appreciated to fix this package on typst 0.13
Hi @rossmeier, your last commit changed the package version in typst.toml to all zeros (0.0.0).
Is that a mistake?
Wuuups, sorry, that was my blunder. I updated the version to have a reproducible version for my personal projects. Shouldn't have done the PR using main :D
Should be fixed now!