|
119 | 119 | let titlenotenumbering(i) = { |
120 | 120 | if i < 6 { ("*", "#", "§", "¶", "‡").at(i - 1) } else { (i - 4) * "*" } |
121 | 121 | } |
122 | | - |
| 122 | + |
123 | 123 | /// Remove white space at begin and end |
124 | 124 | let strip-white-space(content) = { |
125 | | - if (content.has("children")){ |
| 125 | + if (content.has("children")) { |
126 | 126 | let clean = content.children |
127 | | - for i in (0, -1){ |
128 | | - while (clean.len() > 0 and repr(clean.at(i).func()) in ("space", "parbreak")) { |
| 127 | + for i in (0, -1) { |
| 128 | + while ( |
| 129 | + clean.len() > 0 and repr(clean.at(i).func()) in ("space", "parbreak") |
| 130 | + ) { |
129 | 131 | _ = clean.remove(i) |
130 | 132 | } |
131 | 133 | } |
|
137 | 139 |
|
138 | 140 | /// Check if content ends with string |
139 | 141 | let ends-with(content, end) = { |
140 | | - if (content.has("children")){ |
| 142 | + if (content.has("children")) { |
141 | 143 | return ends-with(content.children.filter(c => c.has("text")).last(), end) |
142 | 144 | } else if (content.has("text")) { |
143 | 145 | return content.text.clusters().at(-1).ends-with(end) |
|
555 | 557 | set par(first-line-indent: 0em) |
556 | 558 | layout(size => context { |
557 | 559 | let body = strip-white-space(it.body) // removes trailing whitespace |
558 | | - if (it.kind == table){ |
| 560 | + if (it.kind == table) { |
559 | 561 | // table captions take the form of a heading (word caps) |
560 | 562 | body = wordcaps(body) |
561 | 563 | } else { |
562 | 564 | // figure captions must end with a period |
563 | | - if (not ends-with(body, ".")){ body += "."} |
| 565 | + if (not ends-with(body, ".")) { body += "." } |
564 | 566 | } |
565 | 567 | let caption = [#it.supplement #it.counter.display()#it.separator#body] |
566 | 568 | align( |
|
0 commit comments