further escaping fixes
Matt S Trout [Sun, 12 Aug 2012 17:10:37 +0000 (10:10 -0700)]
lib/HTML/String/TT/Directive.pm
xt/tt.t

index 5e6baad..4a1c819 100644 (file)
@@ -19,7 +19,7 @@ sub textblock {
 sub text {
     my ($class, $text) = @_;
     for ($text) {
-        s/(["\$\@\\])/\\$1/g;
+        s/(["\$\@\\])/"."\\$1"."/g;
         s/\n/"."\\n"."/g;
     }
     return '"' . $text . '"';
diff --git a/xt/tt.t b/xt/tt.t
index bd0af60..debdbbd 100644 (file)
--- a/xt/tt.t
+++ b/xt/tt.t
@@ -28,4 +28,9 @@ is(
     '<tag>Hi <bob></tag>',
 );
 
+is(
+    do_tt('<foo>"$bar"</foo>'."\n"),
+    '<foo>"$bar"</foo>'."\n"
+);
+
 done_testing;