23 lines
335 B
Awk
23 lines
335 B
Awk
|
# escaped lines
|
||
|
/^[ \t]*%/ {
|
||
|
i = index($0, "%");
|
||
|
print substr($0, i+1, length($0)-i);
|
||
|
next;
|
||
|
}
|
||
|
|
||
|
# inline code
|
||
|
/%\(.*%\)/ {
|
||
|
gsub(/'/, "\\'", $0);
|
||
|
gsub(/%\(.*%\)/, "';echo -n &;echo '", $0);
|
||
|
gsub(/%\(/, "", $0);
|
||
|
gsub(/%\)/, "", $0);
|
||
|
printf("echo -n '%s'\n", $0);
|
||
|
next;
|
||
|
}
|
||
|
|
||
|
{
|
||
|
gsub(/'/, "\\'", $0);
|
||
|
printf("echo '%s'\n", $0);
|
||
|
}
|
||
|
|