r26500 - in /trunk/liblocale-maketext-lexicon-perl: ./ debian/ lib/Locale/Maketext/ lib/Locale/Maketext/Extract/Plugin/ t/

ghostbar-guest at users.alioth.debian.org ghostbar-guest at users.alioth.debian.org
Sun Nov 2 04:49:35 UTC 2008


Author: ghostbar-guest
Date: Sun Nov  2 04:49:31 2008
New Revision: 26500

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=26500
Log:
New upstream release

Added:
    trunk/liblocale-maketext-lexicon-perl/LICENSE
      - copied unchanged from r26499, branches/upstream/liblocale-maketext-lexicon-perl/current/LICENSE
    trunk/liblocale-maketext-lexicon-perl/t/9-bug-import-for-subclasses.t
      - copied unchanged from r26499, branches/upstream/liblocale-maketext-lexicon-perl/current/t/9-bug-import-for-subclasses.t
    trunk/liblocale-maketext-lexicon-perl/t/91-pod_test.t
      - copied unchanged from r26499, branches/upstream/liblocale-maketext-lexicon-perl/current/t/91-pod_test.t
Removed:
    trunk/liblocale-maketext-lexicon-perl/t/99-bug-import-for-subclasses.t
Modified:
    trunk/liblocale-maketext-lexicon-perl/Changes
    trunk/liblocale-maketext-lexicon-perl/MANIFEST
    trunk/liblocale-maketext-lexicon-perl/Makefile.PL
    trunk/liblocale-maketext-lexicon-perl/debian/changelog
    trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract.pm
    trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TT2.pm
    trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TextTemplate.pm
    trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/YAML.pm
    trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Lexicon.pm
    trunk/liblocale-maketext-lexicon-perl/t/5-extract.t

Modified: trunk/liblocale-maketext-lexicon-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/Changes?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/Changes (original)
+++ trunk/liblocale-maketext-lexicon-perl/Changes Sun Nov  2 04:49:31 2008
@@ -1,3 +1,22 @@
+[Changes for 0.73 - 2008-10-28]
+ * Locale::Maketext::Extract::Plugin::TextTemplate
+   - renamed MyParser to Locale::Maketext::Extract::Plugin::TextTemplate::Parser
+     to avoid namespace clashes
+ * CPANTS improvements
+   - Updated the Makefile to list all mentioned modules
+   - Added a LICENSE file
+   - added a Test::Pod test
+
+[Changes for 0.72 - 2008-10-10]
+
+Contributed by: Clinton Gormley (DRTECH)
+
+ * Locale::Maketext::Extract::Plugin::TT2
+   - fixed bug where extracted strings still had escaped quotes and backslashes
+   - if args are literal, they're now wrapped in double quotes instead of
+     single quotes
+   - special characters in args are escaped properly
+
 [Changes for 0.71 - 2008-10-05]
 
 * Bump version number of Locale::Maketext::Extract::Plugin::TextTemplate

Modified: trunk/liblocale-maketext-lexicon-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/MANIFEST?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/MANIFEST (original)
+++ trunk/liblocale-maketext-lexicon-perl/MANIFEST Sun Nov  2 04:49:31 2008
@@ -31,8 +31,9 @@
 lib/Locale/Maketext/Lexicon/Gettext.pm
 lib/Locale/Maketext/Lexicon/Msgcat.pm
 lib/Locale/Maketext/Lexicon/Tie.pm
+LICENSE
 Makefile.PL
-MANIFEST			This list of files
+MANIFEST            This list of files
 MANIFEST.SKIP
 META.yml
 README
@@ -45,7 +46,8 @@
 t/6-gettext.t
 t/7-comments.t
 t/8-plugin-args.t
-t/99-bug-import-for-subclasses.t
+t/9-bug-import-for-subclasses.t
+t/91-pod_test.t
 t/comments.po
 t/gencat.m
 t/locale/en/LC_MESSAGES/test.mo

Modified: trunk/liblocale-maketext-lexicon-perl/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/Makefile.PL?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/Makefile.PL (original)
+++ trunk/liblocale-maketext-lexicon-perl/Makefile.PL Sun Nov  2 04:49:31 2008
@@ -10,9 +10,17 @@
 perl_version    '5.005';
 all_from        'lib/Locale/Maketext/Lexicon.pm';
 install_script  'script/xgettext.pl';
-requires        'Locale::Maketext' => '0.01';
-recommends      'Template'  => '2.20';
-recommends      'YAML' => '0.66';
+requires        'Locale::Maketext'     => '0.01';
+recommends      'Template'             => '2.20';
+recommends      'Template::Constants'  => '2.75';
+recommends      'YAML'                 => '0.66';
+recommends      'YAML::Loader'         => '0.66';
+recommends      'HTML::Parser'         => '3.56';
+recommends      'Lingua::EN::Sentence' => '0.25';
+test_requires   'Test::More'           => '0';
+if ( $^O eq 'MSWin32' ) {
+    recommends  'Win32::Console' => '0.09';
+}
 include_deps    'Test::More';
 
 WriteAll;

Modified: trunk/liblocale-maketext-lexicon-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/debian/changelog?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/debian/changelog (original)
+++ trunk/liblocale-maketext-lexicon-perl/debian/changelog Sun Nov  2 04:49:31 2008
@@ -1,3 +1,9 @@
+liblocale-maketext-lexicon-perl (0.73-1) UNRELEASED; urgency=low
+
+  * (NOT RELEASED YET) New upstream release
+
+ -- Jose Luis Rivas <ghostbar38 at gmail.com>  Sun, 02 Nov 2008 00:18:31 -0430
+
 liblocale-maketext-lexicon-perl (0.71-1) unstable; urgency=low
 
   * New upstream release

Modified: trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract.pm?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract.pm (original)
+++ trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract.pm Sun Nov  2 04:49:31 2008
@@ -1,5 +1,5 @@
 package Locale::Maketext::Extract;
-$Locale::Maketext::Extract::VERSION = '0.30';
+$Locale::Maketext::Extract::VERSION = '0.31';
 
 use strict;
 

Modified: trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TT2.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TT2.pm?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TT2.pm (original)
+++ trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TT2.pm Sun Nov  2 04:49:31 2008
@@ -134,6 +134,8 @@
 #===================================
     return ( qw( tt tt2 html ), qr/\.tt2?\./ );
 }
+
+my %Escapes = map { ( "\\$_" => eval("qq(\\$_)") ) } qw(t n r f b a e);
 
 #===================================
 sub extract {
@@ -158,8 +160,16 @@
         || die $parser->error;
 
     foreach my $entry ( @{ $parser->{extracted} } ) {
-        $entry->[2]=~s/^\((.*)\)$/$1/; # Remove () from vars
-        $self->add_entry( @$entry);
+        $entry->[2] =~ s/^\((.*)\)$/$1/s;    # Remove () from vars
+        $_ =~ s/\\'/'/gs                     # Unescape \'
+            for @{$entry}[ 0, 2 ];
+        $entry->[2] =~ s/\\(?!")/\\\\/gs;    # Escape all \ not followed by "
+                                             # Escape argument lists correctly
+        while ( my ( $char, $esc ) = each %Escapes ) {
+            $entry->[2] =~ s/$esc/$char/g;
+        }
+
+        $self->add_entry(@$entry);
     }
 }
 
@@ -235,6 +245,7 @@
 sub textblock {
 #===================================
     my ( $class, $text ) = @_;
+    $text =~ s/([\\'])/\\$1/g;
     return "'$text'";
 }
 
@@ -272,6 +283,7 @@
         {
             my $string = shift @{ $ident->[1] };
             strip_quotes($string);
+            $string =~ s/\\\\/\\/g;
             my $args = join_args( $ident->[1] );
             push @{ $PARSER->{extracted} },
                 [ $string, ${ $PARSER->{LINE} }, $args ];
@@ -284,16 +296,17 @@
 sub text {
 #===================================
     my ( $class, $text ) = @_;
+    $text =~ s/\\/\\\\/g;
     return "'$text'";
 }
 
 #===================================
 sub quoted {
 #===================================
-    my ($class, $items) = @_;
+    my ( $class, $items ) = @_;
     return '' unless @$items;
-    return ($items->[0]) if scalar @$items == 1;
-    return '(' . join(' _ ', @$items) . ')';
+    return ( $items->[0] ) if scalar @$items == 1;
+    return '(' . join( ' _ ', @$items ) . ')';
 }
 
 #===================================
@@ -323,6 +336,7 @@
         unless $name eq "'l'"
             or $name eq "'loc'";
     if ( strip_quotes($block) ) {
+        $block =~ s/\\\\/\\/g;
         $args = join_args( $class->args($args) );
 
         # NOTE: line number is at end of block, and can be a range
@@ -351,7 +365,15 @@
 #===================================
     my $args = shift;
     return '' unless $args && @$args;
-    return '(' . join( ', ', @$args ) . ')';
+    my @new_args = (@$args);
+    for (@new_args) {
+        s/\\\\/\\/g;
+        if ( strip_quotes($_) ) {
+            s/"/\\"/g;
+            $_ = qq{"$_"};
+        }
+    }
+    return '(' . join( ', ', @new_args ) . ')';
 }
 
 =head1 ACKNOWLEDGEMENTS

Modified: trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TextTemplate.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TextTemplate.pm?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TextTemplate.pm (original)
+++ trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/TextTemplate.pm Sun Nov  2 04:49:31 2008
@@ -4,7 +4,7 @@
 use base qw(Locale::Maketext::Extract::Plugin::Base);
 use vars qw($VERSION);
 
-$VERSION = '0.30';
+$VERSION = '0.31';
 
 =head1 NAME
 
@@ -58,8 +58,8 @@
         require Lingua::EN::Sentence;
 
         {
-            package MyParser;
-            @MyParser::ISA = 'HTML::Parser';
+            package Locale::Maketext::Extract::Plugin::TextTemplate::Parser;
+            our @ISA = 'HTML::Parser';
             *{'text'} = sub {
                 my ($self, $str, $is_cdata) = @_;
                 my $sentences = Lingua::EN::Sentence::get_sentences($str) or return;
@@ -68,7 +68,7 @@
             };
         }
 
-        my $p = MyParser->new;
+        my $p = Locale::Maketext::Extract::Plugin::TextTemplate::Parser->new;
         while (m/\G((.*?)^(?:START|END)[A-Z]+$)/smg) {
             my ($str) = ($2);
             $line += ( () = ($1 =~ /\n/g) ); # cryptocontext!

Modified: trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/YAML.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/YAML.pm?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/YAML.pm (original)
+++ trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Extract/Plugin/YAML.pm Sun Nov  2 04:49:31 2008
@@ -37,6 +37,8 @@
 =item key: _'string with embedded 'quotes''
 
 =back
+
+You cannot use block or folded strings with this plugin.
 
 =head1 KNOWN FILE TYPES
 

Modified: trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Lexicon.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Lexicon.pm?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Lexicon.pm (original)
+++ trunk/liblocale-maketext-lexicon-perl/lib/Locale/Maketext/Lexicon.pm Sun Nov  2 04:49:31 2008
@@ -1,5 +1,5 @@
 package Locale::Maketext::Lexicon;
-$Locale::Maketext::Lexicon::VERSION = '0.71';
+$Locale::Maketext::Lexicon::VERSION = '0.73';
 
 use 5.004;
 use strict;

Modified: trunk/liblocale-maketext-lexicon-perl/t/5-extract.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/liblocale-maketext-lexicon-perl/t/5-extract.t?rev=26500&op=diff
==============================================================================
--- trunk/liblocale-maketext-lexicon-perl/t/5-extract.t (original)
+++ trunk/liblocale-maketext-lexicon-perl/t/5-extract.t Sun Nov  2 04:49:31 2008
@@ -1,7 +1,7 @@
 #! /usr/bin/perl -w
 use lib '../lib';
 use strict;
-use Test::More tests => 76;
+use Test::More tests => 95;
 
 use_ok('Locale::Maketext::Extract');
 my $Ext = Locale::Maketext::Extract->new();
@@ -63,7 +63,7 @@
 
 
 #### BEGIN TT TESTS ############
-SKIP: { skip('Template.pm unavailable', 27) unless eval { require Template };
+SKIP: { skip('Template.pm unavailable', 46) unless eval { require Template };
 
 extract_ok(<<'__EXAMPLE__'                 => 'foo bar baz', 'trim the string (tt)');
 [% |loc -%]
@@ -88,7 +88,7 @@
 
 write_po_ok(q([% l('string','arg') %])     => <<'__EXAMPLE__', 'TT l function - literal arg');
 #: :1
-#. ('arg')
+#. ("arg")
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -103,7 +103,7 @@
 
 write_po_ok(q([% 'string' | l('arg')  %])  => <<'__EXAMPLE__', 'TT l inline filter - literal arg');
 #: :1
-#. ('arg')
+#. ("arg")
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -119,6 +119,7 @@
 
 SKIP: {
     skip "Can't handle directive embedded in text blocks",1;
+
     write_po_ok(q([% |l %] string [% var %][% END %])    => '', 'TT l block filter - embedded directive');
 }
 
@@ -130,7 +131,7 @@
 
 write_po_ok(q([% |l('arg') %]string[% END %]) => <<'__EXAMPLE__', 'TT l block filter - literal arg');
 #: :1
-#. ('arg')
+#. ("arg")
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -164,7 +165,7 @@
 
 write_po_ok(q([% 'string' | loc('arg')  %])  => <<'__EXAMPLE__', 'TT loc inline filter - literal arg');
 #: :1
-#. ('arg')
+#. ("arg")
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -203,6 +204,196 @@
 extract_ok(q([% l("embedded \${string}") %]) => 'embedded ${string}', "TT embedded string 2");
 extract_ok(q([% l('embedded ${string}') %]) => 'embedded ${string}',  "TT embedded string 3");
 
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 1');
+[% l('my \ string', 'my \ string') %]
+[% l('my \\ string', 'my \\ string') %]
+[% l("my \\ string", "my \\ string") %]
+__TT__
+#: :1 :2 :3
+#. ("my \\ string")
+msgid "my \\ string"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 2');
+[% l('my str\'ing','my str\'ing') %]
+__TT__
+#: :1
+#. ("my str'ing")
+msgid "my str'ing"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 3');
+[% l('my string"','my string"') %]
+__TT__
+#: :1
+#. ("my string\"")
+msgid "my string\""
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 4');
+[% l("my string'","my string'") %]
+__TT__
+#: :1
+#. ("my string'")
+msgid "my string'"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 5');
+[% l("my \nstring","my \nstring") %]
+__TT__
+#: :1
+#. ("my \nstring")
+msgid ""
+"my \n"
+"string"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 6');
+[% l('my \nstring','my \nstring') %]
+__TT__
+#: :1
+#. ("my \\nstring")
+msgid "my \\nstring"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 7');
+[% 'my \ string'  | l('my \ string') %]
+[% 'my \\ string' | l('my \\ string') %]
+[% "my \\ string" | l("my \\ string") %]
+__TT__
+#: :1 :2 :3
+#. ("my \\ string")
+msgid "my \\ string"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 8');
+[% 'my str\'ing' | l('my str\'ing') %]
+__TT__
+#: :1
+#. ("my str'ing")
+msgid "my str'ing"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 9');
+[% 'my string"' | l('my string"') %]
+__TT__
+#: :1
+#. ("my string\"")
+msgid "my string\""
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 10');
+[% "my string'" |l("my string'") %]
+__TT__
+#: :1
+#. ("my string'")
+msgid "my string'"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 11');
+[% "my \nstring" |l("my \nstring") %]
+__TT__
+#: :0-1
+#. ("my \nstring")
+msgid ""
+"my \n"
+"string"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 12');
+[% 'my \nstring' |l('my \nstring') %]
+__TT__
+#: :1
+#. ("my \\nstring")
+msgid "my \\nstring"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 13');
+[% | l('my \ string') %]my \ string[% END %]
+[% | l('my \\ string') %]my \\ string[% END %]
+__TT__
+#: :1
+#. ("my \\ string")
+msgid "my \\ string"
+msgstr ""
+
+#: :2
+#. ("my \\ string")
+msgid "my \\\\ string"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 14');
+[% | l('my str\'ing') %]my str'ing[% END %]
+__TT__
+#: :1
+#. ("my str'ing")
+msgid "my str'ing"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 15');
+[% | l('my str\'ing') %]my str\'ing[% END %]
+__TT__
+#: :1
+#. ("my str'ing")
+msgid "my str\\'ing"
+msgstr ""
+__EXAMPLE__
+
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 16');
+[% | l("my str\"ing") %]my str"ing[% END %]
+__TT__
+#: :1
+#. ("my str\"ing")
+msgid "my str\"ing"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 17');
+[% | l("my str\"ing") %]my str\"ing[% END %]
+__TT__
+#: :1
+#. ("my str\"ing")
+msgid "my str\\\"ing"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 18');
+[% |l("my \nstring") %]my
+string[% END %]
+__TT__
+#: :1-2
+#. ("my \nstring")
+msgid ""
+"my\n"
+"string"
+msgstr ""
+__EXAMPLE__
+
+write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT quoted - 19');
+[% |l('my \nstring') %]my \nstring[% END %]
+__TT__
+#: :1
+#. ("my \\nstring")
+msgid "my \\nstring"
+msgstr ""
+__EXAMPLE__
+
+
 write_po_ok(<<'__TT__'  => <<'__EXAMPLE__', 'TT key values');
 [% l('string', key1=>'value',key2=>value, key3 => value.method) %]
 __TT__
@@ -216,7 +407,7 @@
 [% l('string',b.method.$var(arg),c('arg').method.5) %]
 __TT__
 #: :1
-#. (b.method.$var(arg), c('arg').method.5)
+#. (b.method.$var(arg), c("arg").method.5)
 msgid "string"
 msgstr ""
 __EXAMPLE__
@@ -225,7 +416,7 @@
 }
 
 #### BEGIN YAML TESTS ############
-SKIP: { skip('YAML.pm unavailable', 27) unless eval { require YAML };
+SKIP: { skip('YAML.pm unavailable', 18) unless eval { require YAML };
 
 extract_ok(qq(key: _"string"\n)               => "string",       "YAML double quotes");
 extract_ok(qq(key: _'string'\n)               => "string",       "YAML single quotes");




More information about the Pkg-perl-cvs-commits mailing list