Restructure code: split features into separate files
This commit is contained in:
16
aux/placeholder.typ
Normal file
16
aux/placeholder.typ
Normal file
@@ -0,0 +1,16 @@
|
||||
#let panicOnPlaceholder = state("panicOnPlaceholder", true)
|
||||
|
||||
// Return the value with a colorful background so it is visibly a placeholder.
|
||||
// Has the ability to panic if panicOnPlaceholder is set to true.
|
||||
#let placeholder(value) = {
|
||||
highlight(
|
||||
fill: rgb(0xff, 0xa2, 0x9c, 0xff),
|
||||
value
|
||||
)
|
||||
|
||||
context(
|
||||
if panicOnPlaceholder.get() {
|
||||
panic("Found placeholder and panicOnPlaceholder is set.")
|
||||
}
|
||||
)
|
||||
}
|
||||
8
aux/valval.typ
Normal file
8
aux/valval.typ
Normal file
@@ -0,0 +1,8 @@
|
||||
// valval - the value validator (tm)
|
||||
|
||||
// panics if value is not in the allowed array
|
||||
#let panicOnInvalid(value, allowed) = {
|
||||
if allowed.find(x => x == value) == none {
|
||||
panic("Value " + value + " is not in " + allowed.join(", "))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user