|
74 | 74 | let indent-list = content.map(c => c.line-indent) |
75 | 75 | let max-indent = indent-list.sorted().last() |
76 | 76 | let colspans = indent-list.map(i => max-indent + 1 - i) |
77 | | - let indent-content = indent-list.map(i => ([], grid.vline(stroke: vstroke), []) * int(i / 2)) |
| 77 | + let indent-content = indent-list.map(i => ( |
| 78 | + ([], grid.vline(stroke: vstroke), []) * int(i / 2) |
| 79 | + )) |
78 | 80 | let indents = (indent,) * max-indent |
79 | 81 | let offset = 18pt + if indents.len() != 0 { indents.sum() } |
80 | 82 | let columns = (..indents, 100% - offset) |
|
85 | 87 | while line-number <= content.len() { |
86 | 88 | if line-numbers { grid-bits.push([#line-number:]) } |
87 | 89 | grid-bits = grid-bits + indent-content.at(line-number - 1) |
88 | | - grid-bits.push(grid.cell(content.at(line-number - 1).line-content, colspan: colspans.at(line-number - 1))) |
| 90 | + grid-bits.push(grid.cell( |
| 91 | + content.at(line-number - 1).line-content, |
| 92 | + colspan: colspans.at(line-number - 1), |
| 93 | + )) |
89 | 94 | line-number = line-number + 1 |
90 | 95 | } |
91 | 96 | return grid( |
|
106 | 111 | line-numbers: true, |
107 | 112 | ..bits, |
108 | 113 | ) = { |
109 | | - return figure(supplement: supplement, kind: "algorithm", caption: title, algorithm( |
110 | | - indent: indent, |
111 | | - inset: inset, |
112 | | - vstroke: vstroke, |
113 | | - line-numbers: line-numbers, |
114 | | - ..bits, |
115 | | - )) |
| 114 | + return figure( |
| 115 | + supplement: supplement, |
| 116 | + kind: "algorithm", |
| 117 | + caption: title, |
| 118 | + algorithm( |
| 119 | + indent: indent, |
| 120 | + inset: inset, |
| 121 | + vstroke: vstroke, |
| 122 | + line-numbers: line-numbers, |
| 123 | + ..bits, |
| 124 | + ), |
| 125 | + ) |
116 | 126 | } |
117 | 127 |
|
118 | 128 | #let iflike-unterminated(kw1: "", kw2: "", cond, ..body) = ( |
|
138 | 148 | (v,) |
139 | 149 | } |
140 | 150 | } |
141 | | -#let call(name, kw: "function", inline: false, style: smallcaps, args, ..body) = ( |
| 151 | +#let call( |
| 152 | + name, |
| 153 | + kw: "function", |
| 154 | + inline: false, |
| 155 | + style: smallcaps, |
| 156 | + args, |
| 157 | + ..body, |
| 158 | +) = ( |
142 | 159 | if inline { |
143 | 160 | [#style(name)\(#arraify(args).join(", ")\)] |
144 | 161 | } else { |
145 | | - iflike(kw1: kw, kw3: "end", (style(name) + $(#arraify(args).join(", "))$), ..body) |
| 162 | + iflike( |
| 163 | + kw1: kw, |
| 164 | + kw3: "end", |
| 165 | + (style(name) + $(#arraify(args).join(", "))$), |
| 166 | + ..body, |
| 167 | + ) |
146 | 168 | } |
147 | 169 | ) |
148 | 170 |
|
|
0 commit comments