summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xht.awk16
1 files changed, 9 insertions, 7 deletions
diff --git a/ht.awk b/ht.awk index 2e8c5d2..59fa393 100755 --- a/ht.awk +++ b/ht.awk
@@ -31,8 +31,16 @@ $0 ~ CONFIG["raw_delim"] {
31 next 31 next
32} 32}
33 33
34# Shell expansion escape hatch
35{
36 gsub(/\\/, "\\\\", $0)
37 gsub(/\$\$/, "$\a", $0)
38 gsub(/\$[^\a]/, "\\\\&", $0)
39 gsub(/\$\a/, "$", $0)
40 gsub(/`/, "\\`", $0)
41}
42
34RAW { 43RAW {
35 gsub(/[\\\$]/, "\\\\&", $0)
36 bufpush(html_escape($0)) 44 bufpush(html_escape($0))
37 next 45 next
38} 46}
@@ -130,11 +138,6 @@ $0 ~ ("^" COMMENT_DELIM) {
130 $0 = templ 138 $0 = templ
131 } 139 }
132 } 140 }
133 # Escape stuff for the shell -- allow $$ to expand
134 gsub(/\$\$/, "$\a", $0)
135 gsub(/\$[^\a]/, "\\\\&", $0)
136 gsub(/\$\a/, "$", $0)
137 gsub(/`/, "\\`", $0)
138 # Push to buffer 141 # Push to buffer
139 bufpush($0, sep) 142 bufpush($0, sep)
140} 143}
@@ -161,7 +164,6 @@ END {
161 } 164 }
162} 165}
163 166
164
165### Buffer-y functions 167### Buffer-y functions
166function buflush() 168function buflush()
167{ 169{