Improve the code formatting
This commit is contained in:
+44
-15
@@ -253,29 +253,58 @@
|
||||
]
|
||||
}
|
||||
|
||||
show raw.where(block: false): it => {
|
||||
box(
|
||||
fill: gray-zut.lighten(93%),
|
||||
inset: (x: 3pt, y: 1pt),
|
||||
radius: 2pt,
|
||||
set raw(theme: "zut.tmTheme")
|
||||
show raw.where(block: true): it => {
|
||||
let lines = it.lines
|
||||
|
||||
block(
|
||||
fill: gray-zut.lighten(100%),
|
||||
radius: 4pt,
|
||||
clip: true,
|
||||
width: 100%,
|
||||
)[
|
||||
#set text(size: 10pt, font: ("Fira Mono", "Courier New"))
|
||||
#it
|
||||
#grid(
|
||||
columns: (auto, 1fr),
|
||||
inset: (left: 10pt, right: 10pt, top: 2pt, bottom: 2pt),
|
||||
align: (x, y) => if x == 0 { right + top } else { left + top },
|
||||
|
||||
grid.vline(x: 1, stroke: (paint: luma(160), thickness: 1pt)),
|
||||
|
||||
..lines
|
||||
.map(line => (
|
||||
text(fill: luma(160), size: 9pt)[#line.number],
|
||||
line.body,
|
||||
))
|
||||
.flatten(),
|
||||
)
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
// ── 3.7 PODPISY RYSUNKÓW I TABEL ────────────────────────
|
||||
set figure(gap: 0.8em)
|
||||
let raw-fig-counter = counter("raw-fig")
|
||||
|
||||
show figure.caption: it => {
|
||||
set text(size: 9.5pt, font: "Fira Sans")
|
||||
let kind-label = if it.kind == image { [Rysunek] } else if it.kind == table { [Tabela] } else { [Algorytm] }
|
||||
[
|
||||
#text(fill: blue-zut, weight: "bold")[
|
||||
#kind-label #it.counter.display()
|
||||
]#it.separator#it.body
|
||||
]
|
||||
show heading.where(level: 1): it => {
|
||||
raw-fig-counter.update(1)
|
||||
it
|
||||
}
|
||||
|
||||
show figure.where(kind: raw): it => {
|
||||
// Step the custom counter
|
||||
raw-fig-counter.step()
|
||||
|
||||
// Build the number: heading-index.figure-index
|
||||
let heading-num = counter(heading.where(level: 1)).display()
|
||||
let fig-num = raw-fig-counter.display("1")
|
||||
let full-number = heading-num + "." + fig-num
|
||||
|
||||
it.body
|
||||
v(10pt, weak: true)
|
||||
align(center, block(width: auto)[
|
||||
#text(weight: "bold", fill: blue-zut, font: "Fira Sans")[Algorytm #full-number:]
|
||||
#text(font: "Fira Sans")[#it.caption.body]
|
||||
])
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user