aboutsummaryrefslogtreecommitdiff
path: root/tests/helpers/common.bash
diff options
context:
space:
mode:
authorAlexander M Pickering <alex@cogarr.net>2026-08-03 21:52:33 -0500
committerAlexander M Pickering <alex@cogarr.net>2026-08-03 21:52:33 -0500
commit6705bdc69e1682982832ebea24e791581c44d0d2 (patch)
tree48ec63b522c03f4e0b5abf6a2cd520dc96ba7eee /tests/helpers/common.bash
parent21eb6acc2fdf0c43a2a1f6d4892cbd253909f82b (diff)
downloadtrbldoc-6705bdc69e1682982832ebea24e791581c44d0d2.tar.gz
trbldoc-6705bdc69e1682982832ebea24e791581c44d0d2.tar.bz2
trbldoc-6705bdc69e1682982832ebea24e791581c44d0d2.zip
Allow comments to have tabsHEADmaster
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/common.bash')
-rw-r--r--tests/helpers/common.bash33
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