Move all awk functions to separate files

This commit is contained in:
2026-03-07 19:42:37 +01:00
parent 3258616282
commit f580ed9cab
17 changed files with 838 additions and 777 deletions

View File

@@ -119,11 +119,35 @@ function css_highlight_line(line, m, prop, val) {
return "<span class=\"tok-punc\">}</span>"
}
if (match(line, /^([[:space:]]*)(--?[A-Za-z0-9_-]+)([[:space:]]*:[[:space:]]*)([^;]*)(;?[[:space:]]*)$/, m)) {
prop = "<span class=\"tok-prop\">" m[2] "</span>"
gsub(/var\(--[A-Za-z0-9_-]+\)/, "<span class=\"tok-var\">&</span>", m[4])
val = "<span class=\"tok-val\">" m[4] "</span>"
return m[1] prop m[3] val m[5]
if (line ~ /^[[:space:]]*--?[A-Za-z0-9_-]+[[:space:]]*:[[:space:]]*[^;]*;?[[:space:]]*$/) {
match(line, /:[[:space:]]*/)
sep_pos = RSTART
sep_len = RLENGTH
pre_sep = substr(line, 1, sep_pos - 1)
sep = substr(line, sep_pos, sep_len)
post_sep = substr(line, sep_pos + sep_len)
match(pre_sep, /--?[A-Za-z0-9_-]+/)
prop_pos = RSTART
prop_len = RLENGTH
indent = substr(pre_sep, 1, prop_pos - 1)
prop_name = substr(pre_sep, prop_pos, prop_len)
if (match(post_sep, /;[[:space:]]*$/)) {
val_part = substr(post_sep, 1, RSTART - 1)
suffix = substr(post_sep, RSTART)
} else {
val_part = post_sep
suffix = ""
}
prop = "<span class=\"tok-prop\">" prop_name "</span>"
gsub(/var\(--[A-Za-z0-9_-]+\)/, "<span class=\"tok-var\">&</span>", val_part)
val = "<span class=\"tok-val\">" val_part "</span>"
return indent prop sep val suffix
}
return line