From: Matt S Trout Date: Sun, 12 Aug 2012 17:10:37 +0000 (-0700) Subject: further escaping fixes X-Git-Tag: v1.000000~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5bee64f99d0f0c221aba7125ae9bd8ddea133467;p=scpubgit%2FHTML-String.git further escaping fixes --- diff --git a/lib/HTML/String/TT/Directive.pm b/lib/HTML/String/TT/Directive.pm index 5e6baad..4a1c819 100644 --- a/lib/HTML/String/TT/Directive.pm +++ b/lib/HTML/String/TT/Directive.pm @@ -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 --- a/xt/tt.t +++ b/xt/tt.t @@ -28,4 +28,9 @@ is( 'Hi ', ); +is( + do_tt('"$bar"'."\n"), + '"$bar"'."\n" +); + done_testing;