diff --git a/sh/core/code.awk b/sh/core/code.awk index 76a8e24..9d68b85 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -22,6 +22,9 @@ function extract(string, type) { } else if (type == "command") { split(string, array, "#/") return trim(array[2]) + } else if (type == "doc") { + split(string, array, "#") + return trim(array[2]) } else if (type == "function") { split(string, array, "(") return trim(array[1]) @@ -157,11 +160,11 @@ BEGIN { # doc if (match($0, RE_SHEBANG)) { append("! " extract($0, "shebang")) - } else if (match($0, RE_DOC, m)) { + } else if (match($0, RE_DOC)) { if (f) { append($0) } else { - append(m[1]) + append(extract($0, "doc")) } } else if (match($0, re["alias"], m)) { append("= " m[1])