Handle Typst 0.11.0 length repr change
PgBiel opened this issue · 0 comments
PgBiel commented
typst/typst#2936 appears to have broken the parsing code introduced by #84 (the commit before that PR to Typst doesn't generate any problems). We seem to get the following error (0.1.0-dev, 0caa364):
error: cannot divide relative length by ratio
┌─ src/utilities.typ:185:6
│
185 │ ((len / 1%) / 100) * page-size + 0pt // e.g. 100% / 1% = 100; / 100 = 1; 1 * page-size
│ ^^^^^^^^
help: error occurred in this call of function `convert-ratio-type-to-pt`
┌─ src/utilities.typ:254:8
│
254 │ convert-ratio-type-to-pt(ratio-part, page-size)
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: error occurred in this call of function `convert-relative-type-to-pt`
┌─ src/utilities.typ:286:8
│
286 │ convert-relative-type-to-pt(len, styles, page-size: page-size)
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: error occurred in this call of function `convert-length-to-pt`
┌─ tablex-test.typ:797:21
│
797 │ let actual = convert-length-to-pt(
│ ╭──────────────────────^
798 │ │ len,
799 │ │ styles: styles,
800 │ │ page-size: page-size,
801 │ │ frac-amount: frac-amount,
802 │ │ frac-total: frac-total,
803 │ │ )
│ ╰─────────^
On the backported version (3f55e0d):
error: cannot divide relative length by ratio
┌─ tablex.typ:449:6
│
449 │ ((len / 1%) / 100) * page-size + 0pt // e.g. 100% / 1% = 100; / 100 = 1; 1 * page-size
│ ^^^^^^^^
help: error occurred in this call of function `convert-ratio-type-to-pt`
┌─ tablex.typ:518:8
│
518 │ convert-ratio-type-to-pt(ratio-part, page-size)
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: error occurred in this call of function `convert-relative-type-to-pt`
┌─ tablex.typ:550:8
│
550 │ convert-relative-type-to-pt(len, styles, page-size: page-size)
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
help: error occurred in this call of function `convert-length-to-pt`
┌─ tablex-test.typ:795:21
│
795 │ let actual = convert-length-to-pt(
│ ╭──────────────────────^
796 │ │ len,
797 │ │ styles: styles,
798 │ │ page-size: page-size,
799 │ │ frac-amount: frac-amount,
800 │ │ frac-total: frac-total,
801 │ │ )
│ ╰─────────^