Issue when no space between () and {
Closed this issue · 5 comments
nicobrinkkemper commented
This got me looking for a solid 10 minutes.
# @brief This will show
# @description This will **not** show
gabr(){
return 0
}
What fixed for me is:
# @brief This will show
# @description This will show
gabr() { # <- note the space here
return 0
}
I don't have time to look for this issue right now, so dropping this here without PR
jdarling commented
PR #5 addresses this, there is a bug in the regex used to process functions. Unfortunately I think this project is dead. I need a doc gen for bash and am basically using the source from the above mentioned PR.
jdarling commented
jdarling commented
#5 and the corresponding bug is also still open, that's what made me think no one monitored it anymore.
kovetskiy commented
I've tested #5 and it produces the same result
diff --git a/shdoc b/shdoc
index 34af115..d4af2f3 100755
--- a/shdoc
+++ b/shdoc
@@ -151,7 +151,7 @@ in_example {
docblock = docblock "\n\n" render("li", $0) "\n"
}
-/^[[:space:]]*(function )?[[:space:]]*([a-zA-Z0-9_:.-]+)(\(\))? \{/ && docblock != "" {
+/^(function\s+)?([a-zA-Z0-9_:-]+)(\s*)(\((\s*)\))?(\s*)\{/ && docblock != "" {
sub(/^[[:space:]]*function /, "")
doc = doc "\n" render("h2", $1) "\n" docblock
●∞ shdoc master ↕ cat a.sh
# @brief This will show
# @description This will **not** show
gabr() {
return 0
}
# @brief This will show2
# @description This will **not** show2
gabr2() {
return 0
}
●∞ shdoc master ↕ ./shdoc < a.sh
This will show
This will show2
* [gabr()](#gabr)
* [gabr2()](#gabr2)
## gabr()
This will **not** show
gabr() {
## gabr2()
This will **not** show2
gabr2() {