From 02c68d3aed70c8029517443f14beb883993e99b1 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 13 Jul 2025 22:26:56 +0200 Subject: [PATCH] mawk/doc --- sh/core/code.awk | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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])