diff options
Diffstat (limited to 'tests/helpers/common.bash')
| -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 |
