From c2a03f54679904aef3a130d8b8b7e45e4e6bcc53 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Sat, 13 Aug 2022 20:46:28 -0500 Subject: Escape .. escapes --- ht.awk | 3 +++ 1 file changed, 3 insertions(+) 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) { for (lt in LINE_TYPES) { if (match($0, "^" lt "[ \t]*")) { $0 = substr($0, RSTART + RLENGTH) + # Escape & in $0 so awk doesn't choke + gsub(/&/, "\\\\&", $0) + # Expand the template templ = LINE_TYPES[lt] while (match(templ, /\$[0-9-]+/)) { if (substr(templ, RSTART + 1, 1) == "-") { -- cgit 1.4.1-21-gabe81