diff options
-rw-r--r-- | subtext.awk | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/subtext.awk b/subtext.awk index 07dfb76..881ebe2 100644 --- a/subtext.awk +++ b/subtext.awk | |||
@@ -59,11 +59,6 @@ end[endn] && $0 == end[endn] { | |||
59 | $0 = substr($0, 3, RSTART?RSTART-3:length) | 59 | $0 = substr($0, 3, RSTART?RSTART-3:length) |
60 | par = par (par?"\n":"") \ | 60 | par = par (par?"\n":"") \ |
61 | "$$(" ($1 ? $1 " " shquote(2) : "") " << " end[endn] | 61 | "$$(" ($1 ? $1 " " shquote(2) : "") " << " end[endn] |
62 | # par = par (par?"\n":"") \ | ||
63 | # "$$(unquote + << .." \ | ||
64 | # (length>2 ? " | " substr($1,3) " " shquote(2) : "") \ | ||
65 | # slurp("..") \ | ||
66 | # "..\n)" | ||
67 | next | 62 | next |
68 | } | 63 | } |
69 | 64 | ||
@@ -122,14 +117,15 @@ function shquote(begin, end, quoted, out) { | |||
122 | if (!begin) begin = 1 | 117 | if (!begin) begin = 1 |
123 | if (!end) end = NF | 118 | if (!end) end = NF |
124 | for (i=begin; i<=NF; i++) { | 119 | for (i=begin; i<=NF; i++) { |
120 | if ($i ~ /"/) quoted = 1 | ||
125 | if ($i ~ /^\$/) { | 121 | if ($i ~ /^\$/) { |
126 | quoted = 1 | 122 | quoted = 1 |
127 | out = out (out?" ":"") "\"" $i | 123 | $i = "\"" $i |
128 | continue | ||
129 | } | 124 | } |
130 | if (($i ~ /\)$/) && quoted) { | 125 | if ((($i ~ /\)$/) || ($i ~ /"$/)) && quoted) { |
131 | quoted = 0 | 126 | quoted = 0 |
132 | out = out (out?" ":"") $i "\"" | 127 | if ($i !~ /"$/) $i = $i "\"" |
128 | out = out (out?" ":"") $i | ||
133 | continue | 129 | continue |
134 | } | 130 | } |
135 | if (!quoted) { | 131 | if (!quoted) { |