diff options
author | Case Duckworth | 2022-08-13 20:46:28 -0500 |
---|---|---|
committer | Case Duckworth | 2022-08-13 20:46:28 -0500 |
commit | c2a03f54679904aef3a130d8b8b7e45e4e6bcc53 (patch) | |
tree | 5bf913c919129ace444a2b144dc8009d91967c0c | |
parent | Fix escaping escape...ing (diff) | |
download | ht-c2a03f54679904aef3a130d8b8b7e45e4e6bcc53.tar.gz ht-c2a03f54679904aef3a130d8b8b7e45e4e6bcc53.zip |
Escape .. escapes
-rwxr-xr-x | ht.awk | 3 |
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) == "-") { |