|
210 | 210 | // Numbering function |
211 | 211 | let next-lno() = { |
212 | 212 | codelst-counter.step() |
213 | | - codelst-counter.display((lno) => [ |
| 213 | + context codelst-counter.display((lno) => [ |
214 | 214 | #if lno >= numbers-first and calc.rem(lno - numbers-first, numbers-step) == 0 [ |
215 | 215 | #numbers-style(codelst-numbering(numbering, lno)) |
216 | 216 | ] |
|
237 | 237 | columns: if numbering == none { |
238 | 238 | (1fr,) |
239 | 239 | } else if numbers-side != right { |
240 | | - (numbers-width, 1fr) |
| 240 | + (numbers-width, gutter, 1fr) |
241 | 241 | } else { |
242 | | - (1fr, numbers-width) |
| 242 | + (1fr, gutter, numbers-width) |
243 | 243 | }, |
244 | | - column-gutter: gutter, |
| 244 | + column-gutter: 0pt, |
245 | 245 | row-gutter: 0pt, |
246 | 246 |
|
247 | 247 | stroke:none, |
248 | 248 | inset: (x: 0pt, y: .25em), |
249 | 249 |
|
250 | 250 | fill: (c, r) => { |
251 | | - r = calc.quo(r, 2) // Fix for column / row numbers counting gutters |
252 | 251 | if r + numbers-start in highlighted { |
253 | 252 | highlight-color |
254 | 253 | } else { |
255 | 254 | none |
256 | 255 | } |
257 | 256 | }, |
258 | 257 | align: (c, r) => { |
259 | | - // c = calc.quo(c, 2) |
260 | 258 | if numbering != none { |
261 | | - if numbers-side != right and c == 0 or (numbers-side == right and c == 1) { |
| 259 | + if numbers-side != right and c == 0 or (numbers-side == right and c == 2) { |
262 | 260 | return numbers-align |
263 | 261 | } |
264 | 262 | } |
|
268 | 266 | ..if numbering == none { |
269 | 267 | code-lines |
270 | 268 | } else if numbers-side != right { |
271 | | - code-lines.map((l) => (next-lno(), l)).flatten() |
| 269 | + code-lines.map((l) => (next-lno(), none, l)).flatten() |
272 | 270 | } else { |
273 | | - code-lines.map((l) => (l, next-lno())).flatten() |
| 271 | + code-lines.map((l) => (l, none, next-lno())).flatten() |
274 | 272 | } |
275 | 273 | ) |
276 | 274 | }) |
|
321 | 319 | #let lineref( label, supplement:"line" ) = locate(loc => { |
322 | 320 | let lines = query(selector(label), loc) |
323 | 321 | assert.ne(lines, (), message: "Label <" + str(label) + "> does not exists.") |
324 | | - [#supplement #numbering("1", ..codelst-counter.at(lines.first().location()))] |
| 322 | + [#supplement #numbering("1", ..context codelst-counter.at(lines.first().location()))] |
325 | 323 | }) |
326 | 324 |
|
327 | 325 | #let codelst-styles( body ) = { |
|
0 commit comments