Rewrote templating engine
This commit is contained in:
parent
63dd5fd5b3
commit
577eba63a0
3 changed files with 29 additions and 7 deletions
22
template.awk
Normal file
22
template.awk
Normal file
|
@ -0,0 +1,22 @@
|
|||
# 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);
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue