diff options
| author | Alexander M Pickering <alex@cogarr.net> | 2026-08-03 21:52:33 -0500 |
|---|---|---|
| committer | Alexander M Pickering <alex@cogarr.net> | 2026-08-03 21:52:33 -0500 |
| commit | 6705bdc69e1682982832ebea24e791581c44d0d2 (patch) | |
| tree | 48ec63b522c03f4e0b5abf6a2cd520dc96ba7eee /tests/helpers | |
| parent | 21eb6acc2fdf0c43a2a1f6d4892cbd253909f82b (diff) | |
| download | trbldoc-master.tar.gz trbldoc-master.tar.bz2 trbldoc-master.zip | |
Currently, comments need to be left-aligned, even if they appear
in an indented block. change the comment form to strip the
same whitespace as the first line so that comments can be indented
without embedding indents in the stdin.
Diffstat (limited to 'tests/helpers')
| -rw-r--r-- | tests/helpers/common.bash | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/helpers/common.bash b/tests/helpers/common.bash index 779cc96..12501bc 100644 --- a/tests/helpers/common.bash +++ b/tests/helpers/common.bash @@ -64,9 +64,18 @@ BEGIN{} /\*\// { if(in_comment) {print "EOF"} in_comment=0 + indent="" +} +in_comment { + line=\$0 + if (indent != "" && index(line, indent) == 1) { + line=substr(line, length(indent)+1) + } + print line } -in_comment {print} /\/\* .+/ && !/\*\// { + indent=\$0 + sub(/[^[:space:]].*/, "", indent) print "chunkfile=\$(mktemp -p ${cache}/chunks)" print "cat > \$chunkfile << \"EOF\"\\n@file " name ":" NR ; if(\$2) {\$1=""; print "@exec " \$0} @@ -83,9 +92,18 @@ BEGIN{} /\]\]/ { if(in_comment) {print "EOF"} in_comment=0 + indent="" +} +in_comment { + line=\$0 + if (indent != "" && index(line, indent) == 1) { + line=substr(line, length(indent)+1) + } + print line } -in_comment {print} /--\[\[ .+/ && !/\]\]$/ { + indent=\$0 + sub(/[^[:space:]].*/, "", indent) print "chunkfile=\$(mktemp -p ${cache}/chunks)" print "cat > \$chunkfile << \"EOF\"\\n@file " name ":" NR ; if(\$2) {\$1=""; print "@exec " \$0} @@ -103,9 +121,18 @@ BEGIN{} /'''/ { if(in_comment) {print "EOF"} in_comment=0 + indent="" +} +in_comment { + line=$0 + if (indent != "" && index(line, indent) == 1) { + line=substr(line, length(indent)+1) + } + print line } -in_comment {print} /'''.+/ && !/'''$/ { + indent=$0 + sub(/[^[:space:]].*/, "", indent) print "chunkfile=$(mktemp -p __PY_CACHE__/chunks)" print "cat > $chunkfile << \"EOF\"\n@file " name ":" NR ; renderer = $0 |
