r77347 - in /branches/upstream/liblingua-es-numeros-perl/current: Changes META.yml lib/Lingua/ES/Numeros.pm t/t01_init.t t/t02_cardinals.t
angelabad-guest at users.alioth.debian.org
angelabad-guest at users.alioth.debian.org
Mon Jul 11 10:11:13 UTC 2011
Author: angelabad-guest
Date: Mon Jul 11 10:11:09 2011
New Revision: 77347
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=77347
Log:
[svn-upgrade] new version liblingua-es-numeros-perl (0.09)
Modified:
branches/upstream/liblingua-es-numeros-perl/current/Changes
branches/upstream/liblingua-es-numeros-perl/current/META.yml
branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm
branches/upstream/liblingua-es-numeros-perl/current/t/t01_init.t
branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t
Modified: branches/upstream/liblingua-es-numeros-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/Changes?rev=77347&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/Changes (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/Changes Mon Jul 11 10:11:09 2011
@@ -1,4 +1,11 @@
Revision history for Perl extension Lingua::ES::Numeros.
+
+0.09 dom jul 10 13:25:46 VET 2011
+ - Fix HTML entities names when MAYUSCULAS=>1 as reported via RT #69323
+ by Eduardo Tubert <eatubert at insoft.com.mx>
+ - New test cases for HTML entity names
+ - Split cardinal method to use cardinal_str. Fixes a bug found after
+ fixing entity names.
0.08 Wed Mar 3 11:43:08 VET 2010
- Create tag :constants to import genre constants
Modified: branches/upstream/liblingua-es-numeros-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/META.yml?rev=77347&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/META.yml (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/META.yml Mon Jul 11 10:11:09 2011
@@ -1,14 +1,22 @@
--- #YAML:1.0
-name: Lingua-ES-Numeros
-version: 0.08
-abstract: Translates numbers to spanish text
-license: ~
-author:
+name: Lingua-ES-Numeros
+version: 0.09
+abstract: Translates numbers to spanish text
+author:
- Jose Rey <jrey at cpan.org>
-generated_by: ExtUtils::MakeMaker version 6.42
-distribution_type: module
-requires:
- Carp: 0
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires:
+ Carp: 0
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.55_02
meta-spec:
- url: http://module-build.sourceforge.net/META-spec-v1.3.html
- version: 1.3
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
Modified: branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm?rev=77347&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/lib/Lingua/ES/Numeros.pm Mon Jul 11 10:11:09 2011
@@ -39,7 +39,7 @@
use base qw( Exporter );
-our $VERSION = '0.08';
+our $VERSION = '0.09';
our @EXPORT = qw( );
our @EXPORT_OK = qw( MALE FEMALE NEUTRAL MASCULINO FEMENINO NEUTRO );
@@ -253,7 +253,7 @@
=cut
-sub cardinal($) {
+sub cardinal_str($) {
my $self = shift;
my $num = shift;
my ( $sgn, $ent, $frc, $exp ) = parse_num( $num, $self->{'DECIMAL'}, $self->{'SEPARADORES'} );
@@ -261,11 +261,16 @@
if (@words) {
unshift @words, $self->{'NEGATIVO'} if $sgn < 0 and $self->{'NEGATIVO'};
unshift @words, $self->{'POSITIVO'} if $sgn > 0 and $self->{'POSITIVO'};
- $self->retval( join( " ", @words ) );
+ return join( " ", @words );
}
else {
- $self->retval('cero');
- }
+ 'cero';
+ }
+}
+
+sub cardinal($) {
+ my $self = shift;
+ $self->retval($self->cardinal_str(shift));
}
=head2 real
@@ -347,7 +352,7 @@
};
}
if ($ent) {
- $ent = $self->cardinal( ( $sgn < 0 ? '-' : '+' ) . $ent );
+ $ent = $self->cardinal_str( ( $sgn < 0 ? '-' : '+' ) . $ent );
}
else {
$ent = 'cero';
@@ -1293,19 +1298,18 @@
sub retval($$) {
my $self = shift;
my $rv = shift;
+ $rv = uc $rv if $self->{MAYUSCULAS};
if ( $self->{ACENTOS} ) {
if ( $self->{HTML} ) {
- $rv =~ s/([áéÃóú])/&$1acute;/g;
- $rv =~ tr/áéÃóú/aeiou/;
+ $rv =~ s/([ÃáÃéÃÃÃóÃú])/&$1acute;/g;
+ $rv =~ tr/ÃáÃéÃÃÃóÃú/AaEeIiOoUu/;
}
}
else {
- $rv =~ tr/áéÃóú/aeiou/;
- }
- return $self->{MAYUSCULAS} ? uc $rv : $rv;
-}
-
-# Preloaded methods go here.
+ $rv =~ tr/ÃáÃéÃÃÃóÃú/AaEeIiOoUu/;
+ }
+ return $rv;
+}
1;
__END__
Modified: branches/upstream/liblingua-es-numeros-perl/current/t/t01_init.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/t/t01_init.t?rev=77347&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/t/t01_init.t (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/t/t01_init.t Mon Jul 11 10:11:09 2011
@@ -9,7 +9,7 @@
use strict;
use warnings;
-use Test::More tests => 81;
+use Test::More tests => 85;
BEGIN { use_ok('Lingua::ES::Numeros') }
#########################
@@ -124,5 +124,23 @@
}
}
+sub simple_tests {
+ my $obj = Lingua::ES::Numeros->new();
+
+ # Check for proper XHTML entity names, testscase for bug #69323
+ # thanks to "Eduardo Tubert" <eatubert at insoft.com.mx>
+ $obj->acentos(1);
+ ok($obj->cardinal(16016) eq "dieciséis mil dieciséis", "Lowercase text with accents");
+ $obj->mayusculas( 1 );
+ ok($obj->cardinal(16016) eq "DIECISÃIS MIL DIECISÃIS", "Uppercase text with accents");
+ $obj->mayusculas( 0 );
+ $obj->html(1);
+ ok($obj->cardinal(16016) eq "dieciséis mil dieciséis", "Lowercase XHTML");
+ $obj->mayusculas( 1 );
+ ok($obj->cardinal(16016) eq "DIECISÉIS MIL DIECISÉIS", "Uppercase XHTML");
+ $obj->mayusculas( 0 );
+}
+
accesors;
parser;
+simple_tests;
Modified: branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t?rev=77347&op=diff
==============================================================================
--- branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t (original)
+++ branches/upstream/liblingua-es-numeros-perl/current/t/t02_cardinals.t Mon Jul 11 10:11:09 2011
@@ -77,6 +77,12 @@
}
}
+sub xml_uc($) {
+ my $t = uc shift;
+ $t =~ s/ACUTE;/acute;/g;
+ return $t;
+}
+
sub cardinal_test_real {
my $self = shift;
@@ -90,7 +96,7 @@
$obj->{'HTML'} = 1;
$obj->{'DECIMAL'} = ",";
$t = $obj->real("122,345");
- is( $t, uc "ciento veintidós CON trescientas cuarenta y cinco milésimas",
+ is( $t, xml_uc "ciento veintidós CON trescientas cuarenta y cinco milésimas",
"t_real_2" );
$obj->{'MAYUSCULAS'} = 0;
$t = $obj->real("122,345");
@@ -123,11 +129,11 @@
is( $t, "ciento veinticuatro CON trescientos cuarenta y cinco milésimos", "t_real_2" );
$obj->{'MAYUSCULAS'} = 1;
$t = $obj->real("122.345");
- is( $t, uc "ciento veintidós CON trescientos cuarenta y cinco milésimos", "t_real_2" );
+ is( $t, xml_uc "ciento veintidós CON trescientos cuarenta y cinco milésimos", "t_real_2" );
$obj->{'HTML'} = 1;
$obj->{'DECIMAL'} = ",";
$t = $obj->real("122,345");
- is( $t, uc "ciento veintidós CON trescientos cuarenta y cinco milésimos",
+ is( $t, xml_uc "ciento veintidós CON trescientos cuarenta y cinco milésimos",
"t_real_2" );
$obj->{'MAYUSCULAS'} = 0;
$t = $obj->real("122,345");
More information about the Pkg-perl-cvs-commits
mailing list