File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11# import " /book.typ" : book-page
22# import " /src.typ" : load_signatures , load_config
3+ # import " /expr.typ" : type_to_code
34
45# show : book-page (" signatures.typ" )
56
67# let config = load_config ()
78# let signatures = load_signatures (config )
89
9- // Render a type
10- # let render_type (typ ) = {
11- let res = ``
12- while type (typ ) == array {
13- res += `[` + raw (str (typ . at (1 ))) + `]`
14- typ = typ . at (0 )
15- }
16- raw (typ ) + res
17- }
18-
1910// Render a signature
2011# let render_signature (sig ) = {
2112 let (lb , rb ) = if sig . kind == " interaction" {
2920 raw (cond ) + ` => `
3021 } else {`` }
3122
32- let input_str = sig . input . map (render_type ). join (`, ` )
23+ let input_str = sig . input . map (type_to_code ). join (`, ` )
3324
3425 let output = sig . at (" output" , default : none )
3526 let output_str = if output != none {
36- render_type (output ) + `; `
27+ type_to_code (output ) + `; `
3728 } else {`` }
3829
3930 return [# cond_str # raw (sig . tag )# lb # output_str # input_str # rb ]
You can’t perform that action at this time.
0 commit comments