From 5d05a75a8d4a33ee6cdf855df5c23e8450b6795f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 2 Aug 2025 19:54:43 +0200 Subject: [PATCH] doc --- sh/core/code.awk | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/sh/core/code.awk b/sh/core/code.awk index c20b230..d6b54d6 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -162,6 +162,14 @@ function parse(string) { current_match = "function" current_function = strip_function(string) + # doc + } else if (match(string, RE_DOC)) { + if (current_function) { + doc_append(string) + } else { + doc_append(strip_first(string, "# ")) + } + # other } else { if (module == target) { @@ -185,16 +193,8 @@ function parse(string) { if (action == "doc") { parse($0) - # doc - if (match($0, RE_DOC)) { - if (current_function) { - doc_append($0) - } else { - doc_append(extract($0, "doc")) - } - # constant - } else if (current_match == "constant") { + if (current_match == "constant") { if (constant == target) { doc_output(constant, "constant") } else {