mawk/doc
All checks were successful
/ job (push) Successful in 2m57s

This commit is contained in:
Marc Beninca 2025-07-13 22:26:56 +02:00
parent 8beb437ce0
commit 02c68d3aed
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -22,6 +22,9 @@ function extract(string, type) {
} else if (type == "command") { } else if (type == "command") {
split(string, array, "#/") split(string, array, "#/")
return trim(array[2]) return trim(array[2])
} else if (type == "doc") {
split(string, array, "#")
return trim(array[2])
} else if (type == "function") { } else if (type == "function") {
split(string, array, "(") split(string, array, "(")
return trim(array[1]) return trim(array[1])
@ -157,11 +160,11 @@ BEGIN {
# doc # doc
if (match($0, RE_SHEBANG)) { if (match($0, RE_SHEBANG)) {
append("! " extract($0, "shebang")) append("! " extract($0, "shebang"))
} else if (match($0, RE_DOC, m)) { } else if (match($0, RE_DOC)) {
if (f) { if (f) {
append($0) append($0)
} else { } else {
append(m[1]) append(extract($0, "doc"))
} }
} else if (match($0, re["alias"], m)) { } else if (match($0, re["alias"], m)) {
append("= " m[1]) append("= " m[1])