summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorCase Duckworth2022-08-13 20:46:28 -0500
committerCase Duckworth2022-08-13 20:46:28 -0500
commitc2a03f54679904aef3a130d8b8b7e45e4e6bcc53 (patch)
tree5bf913c919129ace444a2b144dc8009d91967c0c
parentFix escaping escape...ing (diff)
downloadht-c2a03f54679904aef3a130d8b8b7e45e4e6bcc53.tar.gz
ht-c2a03f54679904aef3a130d8b8b7e45e4e6bcc53.zip
Escape .. escapes
-rwxr-xr-xht.awk3
1 files changed, 3 insertions, 0 deletions
diff --git a/ht.awk b/ht.awk index e33fd73..80eb464 100755 --- a/ht.awk +++ b/ht.awk
@@ -113,6 +113,9 @@ $0 ~ ("^" COMMENT_DELIM) {
113 for (lt in LINE_TYPES) { 113 for (lt in LINE_TYPES) {
114 if (match($0, "^" lt "[ \t]*")) { 114 if (match($0, "^" lt "[ \t]*")) {
115 $0 = substr($0, RSTART + RLENGTH) 115 $0 = substr($0, RSTART + RLENGTH)
116 # Escape & in $0 so awk doesn't choke
117 gsub(/&/, "\\\\&", $0)
118 # Expand the template
116 templ = LINE_TYPES[lt] 119 templ = LINE_TYPES[lt]
117 while (match(templ, /\$[0-9-]+/)) { 120 while (match(templ, /\$[0-9-]+/)) {
118 if (substr(templ, RSTART + 1, 1) == "-") { 121 if (substr(templ, RSTART + 1, 1) == "-") {