Skip to content

Commit

Permalink
simplify map-hlines,vlines validation
Browse files Browse the repository at this point in the history
  • Loading branch information
PgBiel committed Jan 7, 2024
1 parent 7fcb793 commit aedad9a
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/option-parsing.typ
Original file line number Diff line number Diff line change
Expand Up @@ -108,17 +108,23 @@
map-cols: none,
) = {
if type(map-vlines) == _function-type {
vlines = vlines.map(map-vlines)
if vlines.any(h => not is-tablex-vline(h)) {
panic("'map-vlines' function returned a non-vline.")
}
vlines = vlines.map(vline => {
let vline = map-vlines(vline)
if not is-tablex-vline(vline) {
panic("'map-vlines' function returned a non-vline.")
}
vline
})
}

if type(map-hlines) == _function-type {
hlines = hlines.map(map-hlines)
if hlines.any(h => not is-tablex-hline(h)) {
panic("'map-hlines' function returned a non-hline.")
}
hlines = hlines.map(hline => {
let hline = map-hlines(hline)
if not is-tablex-hline(hline) {
panic("'map-hlines' function returned a non-hline.")
}
hline
})
}

let should-map-rows = type(map-rows) == _function-type
Expand Down

0 comments on commit aedad9a

Please sign in to comment.