Skip to content

Commit

Permalink
add module function to manual template
Browse files Browse the repository at this point in the history
  • Loading branch information
SillyFreak committed Oct 20, 2024
1 parent 785cd07 commit 5719d46
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 13 deletions.
18 changes: 5 additions & 13 deletions docs/manual.typ
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,9 @@ one equals #my-package.id[one], 1 = #my-package.id(1)

= Module reference

== `template`

#{
let module = tidy.parse-module(
read("/src/lib.typ"),
// label-prefix: "my-package.",
#module(
"template",
read("/src/lib.typ"),
label-prefix: none,
scope: scope,
)
tidy.show-module(
module,
sort-functions: none,
style: man-style,
)
}
)
28 changes: 28 additions & 0 deletions docs/template.typ
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,34 @@
body
}
#let module(
name,
code,
label-prefix: auto,
scope: (:),
) = {
let label-prefix = if label-prefix == auto {
name + "."
} else if label-prefix != none {
label-prefix + "."
} else {
""
}
let module = tidy.parse-module(
code,
name: raw(name),
label-prefix: label-prefix,
scope: scope,
)
tidy.show-module(
module,
show-module-name: true,
sort-functions: none,
style: man-style,
)
}
#let ref-fn(name) = link(label(name), man-style.mono(name))
#let file-code(filename, code) = pad(x: 4%, block(
Expand Down

0 comments on commit 5719d46

Please sign in to comment.