fixed error when lang of raw figure was empty
Gitea Action for checking typst compilation / run-ci-linux (push) Successful in 30s Details
release / release (push) Successful in 1m3s Details

This commit is contained in:
Sven Vogel 2024-07-22 08:41:02 +02:00
parent 4e82edce06
commit dd8ed6e2f5
2 changed files with 12 additions and 2 deletions

View File

@ -81,6 +81,11 @@
show raw: set text(font: style.code.font, size: style.code.size) show raw: set text(font: style.code.font, size: style.code.size)
show figure.where(kind: raw): it => align(left)[ show figure.where(kind: raw): it => align(left)[
#let content = it.body #let content = it.body
#let lang = if content.has("lang") {
it.body.lang
} else {
none
}
#block( #block(
width: 100%, width: 100%,
fill: ABB-GRAY-06, fill: ABB-GRAY-06,
@ -97,7 +102,7 @@
let (i, l) = e let (i, l) = e
let n = i + 1 let n = i + 1
let n_str = if (calc.rem(n, 1) == 0) or (true and i == 0) { text(font: style.code.font, size: style.code.size, fill: ABB-BLACK, str(n)) } else { none } let n_str = if (calc.rem(n, 1) == 0) or (true and i == 0) { text(font: style.code.font, size: style.code.size, fill: ABB-BLACK, str(n)) } else { none }
(n_str + h(0.5em), raw(lang: content.lang, l)) (n_str + h(0.5em), raw(lang: lang, l))
}) })
} }
else { else {
@ -105,7 +110,7 @@
( left, ), ( left, ),
e => { e => {
let (i, l) = e let (i, l) = e
raw( lang:content.lang, l) raw( lang: lang, l)
} }
) )
} }

View File

@ -7,3 +7,8 @@
== More raw data == More raw data
#lorem(50) #lorem(50)
#figure(
```
```
)