Mc-Zen / tidy

A documentation generator for Typst in Typst.
https://typst.app/universe/package/tidy
MIT License
49 stars 2 forks source link

Compatible with typst 0.11.0? #22

Closed feuermandel closed 2 months ago

feuermandel commented 2 months ago

Dear developer,

I just tied to use tidy with typst 0.11.0.

I copied /SRC to examples and then run

typst c wiggly-doc.typ

instead of building the help, I got several errors.

~/tools/ty/tidy/examples on main !1 ?1 > typst c wiggly-doc.typ error: unknown variable: draw-sine ┌─ src/show-example.typ:48:23 │ 48 │ let preview = [#eval(preamble + code.text, mode: mode, scope: scope + inherited-scope)] │ ^^^^^^^^^^^^^^^^^^^^ │ = hint: if you meant to use subtraction, try adding spaces around the minus sign

help: error occurred in this call of function show-example ┌─ src/styles/minimal.typ:165:2 │
165 │ ╭ show-ex( 166 │ │ ..args, 167 │ │ code-block: block.with(stroke: .5pt + fn-color), 168 │ │ preview-block: block.with(stroke: .5pt + fn-color), 169 │ │ col-spacing: 0pt 170 │ │ ) │ ╰───^

help: error occurred in this call of function show-example ┌─ src/utilities.typ:35:7 │ 35 │ eval(content, mode: "markup", scope: scope) │ ^^^^^^^

help: error occurred in this call of function eval ┌─ src/utilities.typ:35:2 │ 35 │ eval(content, mode: "markup", scope: scope) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

help: error occurred in this call of function eval-docstring ┌─ src/styles/minimal.typ:102:14 │ 102 │ pad(x: 0em, eval-docstring(fn.description, style-args)) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

help: error occurred in this call of function show-function ┌─ src/show-module.typ:120:4 │ 120 │ (style-functions.show-function)(fn, style-args) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

help: error occurred in this call of function show-module ┌─ wiggly-doc.typ:9:1 │ 9 │ #show-module(docs, style: styles.minimal) │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

what am doing wrong?

Thank you so much for your help.

Mc-Zen commented 2 months ago

Hi @feuermandel ,

Everything is alright with the package actually, but I made a change in the example and didn't carry it quite through, apparently. I use the wiggly example in the guide and changed the calling code from

#let docs = tidy.parse-module(
  read("wiggly.typ"), 
  name: "wiggly",
  scope: (wiggly: wiggly)
)

to

#let docs = tidy.parse-module(
  read("wiggly.typ"), 
  name: "wiggly",
  scope: (wiggly: wiggly),
  preamble: "import wiggly: *;"
)

Adding this preamble allows one to call draw-sine() directly in the docstring examples instead of having to write wiggly.draw-sine().

However, I forgot to update the standalone file wiggly-doc.typ accordingly. Thanks for pointing me to this mistake.

PS: I really dig your name :D