From: Matt S Trout Date: Sun, 15 Sep 2013 19:46:47 +0000 (+0000) Subject: Fix to handle no-op escapes such as \\, broken by unicode fix X-Git-Tag: v1.000006~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9722df8b3564e0a937c061092a11184205827497;p=scpubgit%2FHTML-String.git Fix to handle no-op escapes such as \\, broken by unicode fix --- diff --git a/Changes b/Changes index a2f2edb..2c03f84 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,5 @@ + - Fix to handle no-op escapes such as \\, broken by unicode fix + 1.000005 - 2013-09-15 - Fix unicode/wide characters confusing the perl compiler - Ensure TT doesn't try and call methods instead of VMethods diff --git a/lib/HTML/String/TT/Directive.pm b/lib/HTML/String/TT/Directive.pm index 5454785..d78aed4 100644 --- a/lib/HTML/String/TT/Directive.pm +++ b/lib/HTML/String/TT/Directive.pm @@ -36,14 +36,14 @@ sub text { # which then gets overload::constant'ed appropriately. # The first two lines of the s! were assembled from the escape sequences - # table in "Quote and Quote-like Operators" in perlop by Lukas Mai, then - # the last line handles sigils. + # table in "Quote and Quote-like Operators" in perlop by Lucas Mai, then + # the . handles any other single character escape (\$, \@, \\ etc.) my $str = perlstring $text; $str =~ s! \\ ( [abefnrt] | c. | o \{ [0-7]+ \} | x (?: \{ [[:xdigit:]]+ \} | [[:xdigit:]]{1,2} ) | N \{ [^{}]* \} | [0-7]{1,3} - | \$ | \@ ) + | . ) !"."\\$1"."!xg; return $str; diff --git a/xt/tt.t b/xt/tt.t index 151152e..a370a1a 100644 --- a/xt/tt.t +++ b/xt/tt.t @@ -31,8 +31,8 @@ is( # Check we aren't nailed by https://rt.perl.org/rt3/Ticket/Display.html?id=49594 is( - do_tt('"$bar"'."\n"), - '"$bar"'."\n" + do_tt('"$b\\ar"'."\n"), + '"$b\\ar"'."\n" ); { # non-ASCII characters can also trigger the bug