[libhtml-entities-numbered-perl] 01/03: [svn-inject] Installing original source of libhtml-entities-numbered-perl
dom at earth.li
dom at earth.li
Sun May 8 22:10:18 UTC 2016
This is an automated email from the git hooks/post-receive script.
dom pushed a commit to branch master
in repository libhtml-entities-numbered-perl.
commit c817e81c063dc682fa6c6c26b25c9be9d571e23c
Author: Dominic Hargreaves <dom at earth.li>
Date: Thu Mar 6 20:54:03 2008 +0000
[svn-inject] Installing original source of libhtml-entities-numbered-perl
---
Changes | 12 ++
MANIFEST | 18 +++
META.yml | 11 ++
Makefile.PL | 8 +
README | 123 ++++++++++++++++
lib/HTML/Entities/Numbered.pm | 212 ++++++++++++++++++++++++++
lib/HTML/Entities/Numbered/Table.pm | 286 ++++++++++++++++++++++++++++++++++++
t/00_compile.t | 4 +
t/01_name2decimal.t | 11 ++
t/02_name2hex.t | 11 ++
t/03_decimal2name.t | 11 ++
t/04_hex2name.t | 11 ++
t/05_hex2name_lc.t | 11 ++
t/06_invalid.t | 19 +++
t/07_cross.t | 14 ++
t/08_name2decimal_xml.t | 16 ++
t/09_name2hex_xml.t | 16 ++
t/entities.txt | 252 +++++++++++++++++++++++++++++++
18 files changed, 1046 insertions(+)
diff --git a/Changes b/Changes
new file mode 100644
index 0000000..127c805
--- /dev/null
+++ b/Changes
@@ -0,0 +1,12 @@
+Revision history for Perl extension HTML::Entities::Numbered
+
+0.04 Thu Sep 2 23:38:13 2004
+ - The following are suggested by Tatsuhiko Miyagawa.
+ o create HTML entities table in it's way.
+ o removed HTML::Entities from prerequisite pm to build this
+ distribution.
+ o added "_xml" suffixed two functions (name2decimal_xml() and
+ name2hex_xml()) for addapted to create valid XML.
+
+0.03 Tue Aug 11 22:00:26 2004
+ - original version
diff --git a/MANIFEST b/MANIFEST
new file mode 100644
index 0000000..483516c
--- /dev/null
+++ b/MANIFEST
@@ -0,0 +1,18 @@
+Changes
+lib/HTML/Entities/Numbered.pm
+lib/HTML/Entities/Numbered/Table.pm
+Makefile.PL
+MANIFEST This list of files
+README
+t/00_compile.t
+t/01_name2decimal.t
+t/02_name2hex.t
+t/03_decimal2name.t
+t/04_hex2name.t
+t/05_hex2name_lc.t
+t/06_invalid.t
+t/07_cross.t
+t/08_name2decimal_xml.t
+t/09_name2hex_xml.t
+t/entities.txt
+META.yml Module meta-data (added by MakeMaker)
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..66f9280
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,11 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: HTML-Entities-Numbered
+version: 0.04
+version_from: lib/HTML/Entities/Numbered.pm
+installdirs: site
+requires:
+ Test::More: 0.32
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.21
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 0000000..257fd8e
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,8 @@
+use ExtUtils::MakeMaker;
+WriteMakefile(
+ NAME => 'HTML::Entities::Numbered',
+ VERSION_FROM => 'lib/HTML/Entities/Numbered.pm', # finds $VERSION
+ PREREQ_PM => {
+ 'Test::More' => 0.32,
+ },
+);
diff --git a/README b/README
new file mode 100644
index 0000000..b464e7d
--- /dev/null
+++ b/README
@@ -0,0 +1,123 @@
+HTML::Entities::Numbered version 0.04
+=====================================
+
+NAME
+ HTML::Entities::Numbered - Conversion of numbered HTML entities
+
+SYNOPSIS
+ use HTML::Entities::Numbered;
+
+ $html = 'Hi Honey<b>♥</b>';
+
+ # convert named HTML entities to numbered (decimal)
+ $decimal = name2decimal($html); # Hi Honey<b>♥</b>
+
+ # to numbered (hexadecimal)
+ $hex = name2hex($html); # Hi Honey<b>♥</b>
+
+ $content = 'Copyright © Larry Wall';
+
+ # convert numbered HTML entities (decimal) to named
+ $name1 = decimal2name($content); # Copyright © Larry Wall
+
+ $content = 'Copyright © Larry Wall';
+ # convert numbered HTML entitites (hexadecimal) to named
+ $name2 = hex2name($content); # Copyright © Larry Wall
+
+ $xml = '"Give me ¥10,000" > cherie♠';
+
+ # convert named HTML entities to numbered
+ # except valid XML entities (decimal)
+ $decimal = name2decimal_xml($xml); # "Give me ¥10,000"
+ # > cherie♠
+
+ # to numbered except valid XML entities (hexdecimal)
+ $hex = name2hex_xml($xml); # "Give me ¥10,000"
+ # > cherie♠
+
+DESCRIPTION
+ HTML::Entities::Numbered is a content conversion filter for named HTML
+ entities (symbols, mathmetical symbols, Greek letters, Latin letters,
+ etc.). When an argument of "name2decimal()" or "name2hex()" contains
+ some nameable HTML entities, they will be replaced to numbered HTML
+ entities. And when an argument of "name2decimal_xml()" or
+ "name2hex_xml()" contains some nameable numbered HTML entities, they
+ will be replaced to numbered HTML entities except valid XML entities
+ (the excepted "valid XML entities" are the following five entities:
+ "<", ">", "&", """, "'"). By the same token, when an
+ argument of "decimal2name()" or "hex2name()" contains some nameable
+ numbered HTML entities, they will be replaced to named HTML entities.
+
+ (the exception "valid XML entities" means the following five entities:
+ "<", ">", "&", """, "'")
+
+ On version 0.03, the entities hash table is imported from HTML::Entities
+ (with obsolete class "HTML::Entities::Numbered::Extra" for older
+ releases of Perl). At the moment, 0.04 (or later) is included
+ HTML::Entities::Numbered::Table to import HTML entities table, and
+ thereby we do not need to have HTML::Entities (included in HTML::Parser
+ distribution).
+
+ This may be also useful for making valid XML (corrects the undefined
+ entity references, and enhanced by addition of functions conform to the
+ XML).
+
+FUNCTIONS
+ Following all functions are exported by default.
+
+ * name2decimal
+ Some included named HTML entities in argument of "name2decimal()"
+ will be replaced to decimal numbered HTML entities.
+
+ * name2hex
+ Some included named HTML entities in argument of "name2hex()" will
+ be replaced to hexadecimal numbered HTML entities.
+
+ * decimal2name
+ Some include decimal numbered HTML entities in argument of
+ "decimal2name()" will be replaced to named HTML entities (If they're
+ nameable).
+
+ * hex2name
+ Some include hexadecimal numbered HTML entities in argument of
+ "hex2name()" will be replaced to named HTML entities (If they're
+ nameable).
+
+ * name2decimal_xml
+ Some included named HTML entities in argument of
+ "name2decimal_xml()" will be replaced to decimal numbered HTML
+ entities except valid XML entities.
+
+ * name2hex_xml
+ Some included named HTML entities in argument of "name2hex_xml()"
+ will be replaced to hexadecimal numbered HTML entities except valid
+ XML entities.
+
+ If you'd prefer not to import them functions into the caller's
+ namespace, you can call them as below:
+
+ use HTML::Entities::Numbered ();
+
+ $decimal = HTML::Entities::Numbered::name2decimal($str);
+ $hex = HTML::Entities::Numbered::name2hex($str);
+ $named1 = HTML::Entities::Numbered::decimal2name($str);
+ $named2 = HTML::Entities::Numbered::hex2name($str);
+ $decimal = HTML::Entities::Numbered::name2decimal_xml($str);
+ $hex = HTML::Entities::Numbered::name2hex_xml($str);
+
+AUTHOR
+ Koichi Taniguchi <taniguchi at livedoor.jp>
+
+ Develop triggered by IKEBE Tomohiro <ikebe at cpan.org>
+
+ Many thanks to Tatsuhiko Miyagawa <miyagawa at cpan.org>
+
+COPYRIGHT
+ Copyright (c) 2004 Koichi Taniguchi. Japan. All rights reserved.
+
+ This library is free software; you can redistribute it and/or modify it
+ under the same terms as Perl itself.
+
+SEE ALSO
+ HTML::Entities, <http://www.w3.org/TR/REC-html40/sgml/entities.html>
+
diff --git a/lib/HTML/Entities/Numbered.pm b/lib/HTML/Entities/Numbered.pm
new file mode 100644
index 0000000..f6df3d7
--- /dev/null
+++ b/lib/HTML/Entities/Numbered.pm
@@ -0,0 +1,212 @@
+package HTML::Entities::Numbered;
+
+use strict;
+use HTML::Entities::Numbered::Table;
+use base qw(Exporter);
+use vars qw($VERSION @EXPORT %DECIMALS %ENTITIES);
+ at EXPORT = qw(
+ name2decimal name2hex name2decimal_xml name2hex_xml decimal2name hex2name
+);
+
+$VERSION = '0.04';
+
+BEGIN { %ENTITIES = reverse %DECIMALS }
+
+sub name2decimal {
+ my $content = shift;
+ $content =~ s/(&[a-z0-9]+;)/_convert2num($1, '&#%d;')/ieg;
+ return $content;
+}
+
+sub name2hex {
+ my $content = shift;
+ $content =~ s/(&[a-z0-9]+;)/_convert2num($1, '&#x%X;')/ieg;
+ return $content;
+}
+
+sub name2decimal_xml {
+ my $content = shift;
+ $content =~ s{(&(?:(lt|gt|amp|quot|apos)|[a-z0-9]+);)}
+ { $2 ? $1 : _convert2num($1, '&#%d;') }ieg;
+ return $content;
+}
+
+sub name2hex_xml {
+ my $content = shift;
+ $content =~ s{(&(?:(lt|gt|amp|quot|apos)|[a-z0-9]+);)}
+ { $2 ? $1 : _convert2num($1, '&#x%X;') }ieg;
+ return $content;
+}
+
+sub decimal2name {
+ my $content = shift;
+ $content =~ s/(&#\d+;)/_convert2name($1)/ieg;
+ return $content;
+}
+
+sub hex2name {
+ my $content = shift;
+ $content =~ s/(&#x[a-f0-9]+;)/_convert2name($1)/ieg;
+ return $content;
+}
+
+sub _convert2num {
+ my($reference, $format) = @_;
+ my($name) = $reference =~ /^&([a-z0-9]+);$/i;
+ return exists $DECIMALS{$name} ?
+ sprintf($format, $DECIMALS{$name}) : $reference;
+}
+
+sub _convert2name {
+ my $reference = shift;
+ my($is_hex, $decimal) = $reference =~ /^&#(x?)([a-f0-9]+);$/i;
+ $decimal = sprintf('%d', ($is_hex ? hex($decimal) : $decimal));
+ return exists $ENTITIES{$decimal} ?
+ sprintf('&%s;', $ENTITIES{$decimal}) : $reference;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+HTML::Entities::Numbered - Conversion of numbered HTML entities
+
+=head1 SYNOPSIS
+
+ use HTML::Entities::Numbered;
+
+ $html = 'Hi Honey<b>♥</b>';
+
+ # convert named HTML entities to numbered (decimal)
+ $decimal = name2decimal($html); # Hi Honey<b>♥</b>
+
+ # to numbered (hexadecimal)
+ $hex = name2hex($html); # Hi Honey<b>♥</b>
+
+ $content = 'Copyright © Larry Wall';
+
+ # convert numbered HTML entities (decimal) to named
+ $name1 = decimal2name($content); # Copyright © Larry Wall
+
+ $content = 'Copyright © Larry Wall';
+ # convert numbered HTML entitites (hexadecimal) to named
+ $name2 = hex2name($content); # Copyright © Larry Wall
+
+ $xml = '"Give me ¥10,000" > cherie♠';
+
+ # convert named HTML entities to numbered
+ # except valid XML entities (decimal)
+ $decimal = name2decimal_xml($xml); # "Give me ¥10,000"
+ # > cherie♠
+
+ # to numbered except valid XML entities (hexdecimal)
+ $hex = name2hex_xml($xml); # "Give me ¥10,000"
+ # > cherie♠
+
+=head1 DESCRIPTION
+
+HTML::Entities::Numbered is a content conversion filter for named HTML
+entities (symbols, mathmetical symbols, Greek letters, Latin letters,
+etc.).
+When an argument of C<name2decimal()> or C<name2hex()> contains some
+B<nameable> HTML entities, they will be replaced to numbered HTML
+entities. And when an argument of C<name2decimal_xml()> or
+C<name2hex_xml()> contains some B<nameable> numbered HTML entities,
+they will be replaced to numbered HTML entities B<except valid XML
+entities> (the excepted "valid XML entities" are the following five
+entities: C<<>, C<>>, C<&>, C<">, C<'>).
+By the same token, when an argument of C<decimal2name()> or
+C<hex2name()> contains some B<nameable> numbered HTML entities, they
+will be replaced to named HTML entities.
+
+(the exception "valid XML entities" means the following five entities:
+C<<>, C<>>, C<&>, C<">, C<'>)
+
+On version 0.03, the entities hash table is imported from
+L<HTML::Entities> (with obsolete class
+C<HTML::Entities::Numbered::Extra> for older releases of Perl).
+At the moment, 0.04 (or later) is included
+L<HTML::Entities::Numbered::Table> to import HTML entities table, and
+thereby we do not need to have L<HTML::Entities> (included in
+L<HTML::Parser> distribution).
+
+This may be also useful for making valid XML (corrects the undefined
+entity references, and enhanced by addition of functions conform to
+the XML).
+
+=head1 FUNCTIONS
+
+Following all functions are exported by default.
+
+=over 4
+
+=item * name2decimal
+
+Some included named HTML entities in argument of C<name2decimal()>
+will be replaced to decimal numbered HTML entities.
+
+=item * name2hex
+
+Some included named HTML entities in argument of C<name2hex()>
+will be replaced to hexadecimal numbered HTML entities.
+
+=item * decimal2name
+
+Some include decimal numbered HTML entities in argument of
+C<decimal2name()> will be replaced to named HTML entities
+(If they're nameable).
+
+=item * hex2name
+
+Some include hexadecimal numbered HTML entities in argument of
+C<hex2name()> will be replaced to named HTML entities
+(If they're nameable).
+
+=item * name2decimal_xml
+
+Some included named HTML entities in argument of C<name2decimal_xml()>
+will be replaced to decimal numbered HTML entities B<except valid XML
+entities>.
+
+=item * name2hex_xml
+
+Some included named HTML entities in argument of C<name2hex_xml()>
+will be replaced to hexadecimal numbered HTML entities B<except valid
+XML entities>.
+
+=back
+
+If you'd prefer not to import them functions into the caller's
+namespace, you can call them as below:
+
+ use HTML::Entities::Numbered ();
+
+ $decimal = HTML::Entities::Numbered::name2decimal($str);
+ $hex = HTML::Entities::Numbered::name2hex($str);
+ $named1 = HTML::Entities::Numbered::decimal2name($str);
+ $named2 = HTML::Entities::Numbered::hex2name($str);
+ $decimal = HTML::Entities::Numbered::name2decimal_xml($str);
+ $hex = HTML::Entities::Numbered::name2hex_xml($str);
+
+=head1 AUTHOR
+
+Koichi Taniguchi E<lt>taniguchi at livedoor.jpE<gt>
+
+Develop triggered by IKEBE Tomohiro E<lt>ikebe at cpan.orgE<gt>
+
+Many thanks to Tatsuhiko Miyagawa E<lt>miyagawa at cpan.orgE<gt>
+
+=head1 COPYRIGHT
+
+Copyright (c) 2004 Koichi Taniguchi. Japan. All rights reserved.
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+L<HTML::Entities>,
+L<http://www.w3.org/TR/REC-html40/sgml/entities.html>
+
+=cut
diff --git a/lib/HTML/Entities/Numbered/Table.pm b/lib/HTML/Entities/Numbered/Table.pm
new file mode 100644
index 0000000..ff775fa
--- /dev/null
+++ b/lib/HTML/Entities/Numbered/Table.pm
@@ -0,0 +1,286 @@
+package HTML::Entities::Numbered::Table;
+
+use strict;
+use vars qw($VERSION %DECIMALS @EXPORT);
+use base qw(Exporter);
+ at EXPORT = qw(%DECIMALS);
+
+$VERSION = '0.01';
+
+%DECIMALS = (
+ quot => 34,
+ amp => 38,
+ apos => 39,
+ lt => 60,
+ gt => 62,
+ nbsp => 160,
+ iexcl => 161,
+ cent => 162,
+ pound => 163,
+ curren => 164,
+ yen => 165,
+ brvbar => 166,
+ sect => 167,
+ uml => 168,
+ copy => 169,
+ ordf => 170,
+ laquo => 171,
+ not => 172,
+ shy => 173,
+ reg => 174,
+ macr => 175,
+ deg => 176,
+ plusmn => 177,
+ sup2 => 178,
+ sup3 => 179,
+ acute => 180,
+ micro => 181,
+ para => 182,
+ middot => 183,
+ cedil => 184,
+ sup1 => 185,
+ ordm => 186,
+ raquo => 187,
+ frac14 => 188,
+ frac12 => 189,
+ frac34 => 190,
+ iquest => 191,
+ Agrave => 192,
+ Aacute => 193,
+ Acirc => 194,
+ Atilde => 195,
+ Auml => 196,
+ Aring => 197,
+ AElig => 198,
+ Ccedil => 199,
+ Egrave => 200,
+ Eacute => 201,
+ Ecirc => 202,
+ Euml => 203,
+ Igrave => 204,
+ Iacute => 205,
+ Icirc => 206,
+ Iuml => 207,
+ ETH => 208,
+ Ntilde => 209,
+ Ograve => 210,
+ Oacute => 211,
+ Ocirc => 212,
+ Otilde => 213,
+ Ouml => 214,
+ times => 215,
+ Oslash => 216,
+ Ugrave => 217,
+ Uacute => 218,
+ Ucirc => 219,
+ Uuml => 220,
+ Yacute => 221,
+ THORN => 222,
+ szlig => 223,
+ agrave => 224,
+ aacute => 225,
+ acirc => 226,
+ atilde => 227,
+ auml => 228,
+ aring => 229,
+ aelig => 230,
+ ccedil => 231,
+ egrave => 232,
+ eacute => 233,
+ ecirc => 234,
+ euml => 235,
+ igrave => 236,
+ iacute => 237,
+ icirc => 238,
+ iuml => 239,
+ eth => 240,
+ ntilde => 241,
+ ograve => 242,
+ oacute => 243,
+ ocirc => 244,
+ otilde => 245,
+ ouml => 246,
+ divide => 247,
+ oslash => 248,
+ ugrave => 249,
+ uacute => 250,
+ ucirc => 251,
+ uuml => 252,
+ yacute => 253,
+ thorn => 254,
+ yuml => 255,
+ OElig => 338,
+ oelig => 339,
+ Scaron => 352,
+ scaron => 353,
+ Yuml => 376,
+ fnof => 402,
+ circ => 710,
+ tilde => 732,
+ Alpha => 913,
+ Beta => 914,
+ Gamma => 915,
+ Delta => 916,
+ Epsilon => 917,
+ Zeta => 918,
+ Eta => 919,
+ Theta => 920,
+ Iota => 921,
+ Kappa => 922,
+ Lambda => 923,
+ Mu => 924,
+ Nu => 925,
+ Xi => 926,
+ Omicron => 927,
+ Pi => 928,
+ Rho => 929,
+ Sigma => 931,
+ Tau => 932,
+ Upsilon => 933,
+ Phi => 934,
+ Chi => 935,
+ Psi => 936,
+ Omega => 937,
+ alpha => 945,
+ beta => 946,
+ gamma => 947,
+ delta => 948,
+ epsilon => 949,
+ zeta => 950,
+ eta => 951,
+ theta => 952,
+ iota => 953,
+ kappa => 954,
+ lambda => 955,
+ mu => 956,
+ nu => 957,
+ xi => 958,
+ omicron => 959,
+ pi => 960,
+ rho => 961,
+ sigmaf => 962,
+ sigma => 963,
+ tau => 964,
+ upsilon => 965,
+ phi => 966,
+ chi => 967,
+ psi => 968,
+ omega => 969,
+ thetasym => 977,
+ upsih => 978,
+ piv => 982,
+ ensp => 8194,
+ emsp => 8195,
+ thinsp => 8201,
+ zwnj => 8204,
+ zwj => 8205,
+ lrm => 8206,
+ rlm => 8207,
+ ndash => 8211,
+ mdash => 8212,
+ lsquo => 8216,
+ rsquo => 8217,
+ sbquo => 8218,
+ ldquo => 8220,
+ rdquo => 8221,
+ bdquo => 8222,
+ dagger => 8224,
+ Dagger => 8225,
+ bull => 8226,
+ hellip => 8230,
+ permil => 8240,
+ prime => 8242,
+ Prime => 8243,
+ lsaquo => 8249,
+ rsaquo => 8250,
+ oline => 8254,
+ frasl => 8260,
+ euro => 8364,
+ image => 8465,
+ weierp => 8472,
+ real => 8476,
+ trade => 8482,
+ alefsym => 8501,
+ larr => 8592,
+ uarr => 8593,
+ rarr => 8594,
+ darr => 8595,
+ harr => 8596,
+ crarr => 8629,
+ lArr => 8656,
+ uArr => 8657,
+ rArr => 8658,
+ dArr => 8659,
+ hArr => 8660,
+ forall => 8704,
+ part => 8706,
+ exist => 8707,
+ empty => 8709,
+ nabla => 8711,
+ isin => 8712,
+ notin => 8713,
+ ni => 8715,
+ prod => 8719,
+ sum => 8721,
+ minus => 8722,
+ lowast => 8727,
+ radic => 8730,
+ prop => 8733,
+ infin => 8734,
+ ang => 8736,
+ and => 8743,
+ or => 8744,
+ cap => 8745,
+ cup => 8746,
+ int => 8747,
+ there4 => 8756,
+ sim => 8764,
+ cong => 8773,
+ asymp => 8776,
+ ne => 8800,
+ equiv => 8801,
+ le => 8804,
+ ge => 8805,
+ sub => 8834,
+ sup => 8835,
+ nsub => 8836,
+ sube => 8838,
+ supe => 8839,
+ oplus => 8853,
+ otimes => 8855,
+ perp => 8869,
+ sdot => 8901,
+ lceil => 8968,
+ rceil => 8969,
+ lfloor => 8970,
+ rfloor => 8971,
+ lang => 9001,
+ rang => 9002,
+ loz => 9674,
+ spades => 9824,
+ clubs => 9827,
+ hearts => 9829,
+ diams => 9830,
+);
+
+1;
+__END__
+
+=head1 NAME
+
+HTML::Entities::Numbered::Table - HTML entities table
+
+=head1 SYNOPSIS
+
+B<DO NOT USE THIS MODULE DIRECTLY>
+
+=head1 DESCRIPTION
+
+HTML::Entities::Numbered::Table is HTML entities table. The table is
+including every named entity and decimal pairs.
+
+=head1 AUTHOR
+
+Koichi Taniguchi E<lt>taniguchi at livedoor.jpE<gt>
+
+=cut
diff --git a/t/00_compile.t b/t/00_compile.t
new file mode 100644
index 0000000..6335ca7
--- /dev/null
+++ b/t/00_compile.t
@@ -0,0 +1,4 @@
+use strict;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'HTML::Entities::Numbered' }
diff --git a/t/01_name2decimal.t b/t/01_name2decimal.t
new file mode 100644
index 0000000..fff593a
--- /dev/null
+++ b/t/01_name2decimal.t
@@ -0,0 +1,11 @@
+use strict;
+use Test::More tests => 252;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ ok(name2decimal($entity[0]) eq $entity[1]);
+}
+close ENT;
diff --git a/t/02_name2hex.t b/t/02_name2hex.t
new file mode 100644
index 0000000..4fb7a09
--- /dev/null
+++ b/t/02_name2hex.t
@@ -0,0 +1,11 @@
+use strict;
+use Test::More tests => 252;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ ok(name2hex($entity[0]) eq $entity[2]);
+}
+close ENT;
diff --git a/t/03_decimal2name.t b/t/03_decimal2name.t
new file mode 100644
index 0000000..c2d2db1
--- /dev/null
+++ b/t/03_decimal2name.t
@@ -0,0 +1,11 @@
+use strict;
+use Test::More tests => 252;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ ok(decimal2name($entity[1]) eq $entity[0]);
+}
+close ENT;
diff --git a/t/04_hex2name.t b/t/04_hex2name.t
new file mode 100644
index 0000000..3e3b2b9
--- /dev/null
+++ b/t/04_hex2name.t
@@ -0,0 +1,11 @@
+use strict;
+use Test::More tests => 252;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ ok(hex2name($entity[2]) eq $entity[0]);
+}
+close ENT;
diff --git a/t/05_hex2name_lc.t b/t/05_hex2name_lc.t
new file mode 100644
index 0000000..ca1d18f
--- /dev/null
+++ b/t/05_hex2name_lc.t
@@ -0,0 +1,11 @@
+use strict;
+use Test::More tests => 252;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ ok(hex2name(lc($entity[2])) eq $entity[0]);
+}
+close ENT;
diff --git a/t/06_invalid.t b/t/06_invalid.t
new file mode 100644
index 0000000..e3dce1e
--- /dev/null
+++ b/t/06_invalid.t
@@ -0,0 +1,19 @@
+use strict;
+use Test::More tests => 504;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ my $changed = $entity[0];
+ $changed =~ tr/A-Za-z/a-zA-Z/;
+ ok(name2decimal($changed) ne $entity[1]);
+ unless ($changed =~ /^&(?:thorn|eth);$/i) {
+ ok(name2decimal($changed) eq $changed);
+ }
+ else {
+ ok(name2decimal($changed) ne $changed);
+ }
+}
+close ENT;
diff --git a/t/07_cross.t b/t/07_cross.t
new file mode 100644
index 0000000..f6ead0e
--- /dev/null
+++ b/t/07_cross.t
@@ -0,0 +1,14 @@
+use strict;
+use Test::More tests => 1008;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ ok(decimal2name(name2decimal($entity[0])) eq $entity[0]);
+ ok(name2decimal(decimal2name($entity[1])) eq $entity[1]);
+ ok(name2hex(hex2name($entity[2])) eq $entity[2]);
+ ok(hex2name(name2hex(decimal2name(name2decimal($entity[0])))) eq $entity[0]);
+}
+close ENT;
diff --git a/t/08_name2decimal_xml.t b/t/08_name2decimal_xml.t
new file mode 100644
index 0000000..4358a52
--- /dev/null
+++ b/t/08_name2decimal_xml.t
@@ -0,0 +1,16 @@
+use strict;
+use Test::More tests => 252;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ unless ($entity[0] =~ /^&(?:lt|gt|amp|quot|apos);/) {
+ ok(name2decimal_xml($entity[0]) eq $entity[1]);
+ }
+ else {
+ ok(name2decimal_xml($entity[0]) eq $entity[0]);
+ }
+}
+close ENT;
diff --git a/t/09_name2hex_xml.t b/t/09_name2hex_xml.t
new file mode 100644
index 0000000..b6297a2
--- /dev/null
+++ b/t/09_name2hex_xml.t
@@ -0,0 +1,16 @@
+use strict;
+use Test::More tests => 252;
+use HTML::Entities::Numbered;
+
+open(ENT, 't/entities.txt') || die $!;
+while (<ENT>) {
+ chomp;
+ my @entity = split /\t+/, $_;
+ unless ($entity[0] =~ /^&(?:lt|gt|amp|quot|apos);/) {
+ ok(name2hex_xml($entity[0]) eq $entity[2]);
+ }
+ else {
+ ok(name2hex_xml($entity[0]) eq $entity[0]);
+ }
+}
+close ENT;
diff --git a/t/entities.txt b/t/entities.txt
new file mode 100644
index 0000000..ebd85a2
--- /dev/null
+++ b/t/entities.txt
@@ -0,0 +1,252 @@
+  
+¡ ¡ ¡
+¢ ¢ ¢
+£ £ £
+¤ ¤ ¤
+¥ ¥ ¥
+¦ ¦ ¦
+§ § §
+¨ ¨ ¨
+© © ©
+ª ª ª
+« « «
+¬ ¬ ¬
+ ­
+® ® ®
+¯ ¯ ¯
+° ° °
+± ± ±
+² ² ²
+³ ³ ³
+´ ´ ´
+µ µ µ
+¶ ¶ ¶
+· · ·
+¸ ¸ ¸
+¹ ¹ ¹
+º º º
+» » »
+¼ ¼ ¼
+½ ½ ½
+¾ ¾ ¾
+¿ ¿ ¿
+À À À
+Á Á Á
+Â Â Â
+Ã Ã Ã
+Ä Ä Ä
+Å Å Å
+Æ Æ Æ
+Ç Ç Ç
+È È È
+É É É
+Ê Ê Ê
+Ë Ë Ë
+Ì Ì Ì
+Í Í Í
+Î Î Î
+Ï Ï Ï
+Ð Ð Ð
+Ñ Ñ Ñ
+Ò Ò Ò
+Ó Ó Ó
+Ô Ô Ô
+Õ Õ Õ
+Ö Ö Ö
+× × ×
+Ø Ø Ø
+Ù Ù Ù
+Ú Ú Ú
+Û Û Û
+Ü Ü Ü
+Ý Ý Ý
+Þ Þ Þ
+ß ß ß
+à à à
+á á á
+â â â
+ã ã ã
+ä ä ä
+å å å
+æ æ æ
+ç ç ç
+è è è
+é é é
+ê ê ê
+ë ë ë
+ì ì ì
+í í í
+î î î
+ï ï ï
+ð ð ð
+ñ ñ ñ
+ò ò ò
+ó ó ó
+ô ô ô
+õ õ õ
+ö ö ö
+÷ ÷ ÷
+ø ø ø
+ù ù ù
+ú ú ú
+û û û
+ü ü ü
+ý ý ý
+þ þ þ
+ÿ ÿ ÿ
+ƒ ƒ ƒ
+Α Α Α
+Β Β Β
+Γ Γ Γ
+Δ Δ Δ
+Ε Ε Ε
+Ζ Ζ Ζ
+Η Η Η
+Θ Θ Θ
+Ι Ι Ι
+Κ Κ Κ
+Λ Λ Λ
+Μ Μ Μ
+Ν Ν Ν
+Ξ Ξ Ξ
+Ο Ο Ο
+Π Π Π
+Ρ Ρ Ρ
+Σ Σ Σ
+Τ Τ Τ
+Υ Υ Υ
+Φ Φ Φ
+Χ Χ Χ
+Ψ Ψ Ψ
+Ω Ω Ω
+α α α
+β β β
+γ γ γ
+δ δ δ
+ε ε ε
+ζ ζ ζ
+η η η
+θ θ θ
+ι ι ι
+κ κ κ
+λ λ λ
+μ μ μ
+ν ν ν
+ξ ξ ξ
+ο ο ο
+π π π
+ρ ρ ρ
+ς ς ς
+σ σ σ
+τ τ τ
+υ υ υ
+φ φ φ
+χ χ χ
+ψ ψ ψ
+ω ω ω
+ϑ ϑ ϑ
+ϒ ϒ ϒ
+ϖ ϖ ϖ
+• • •
+… … …
+′ ′ ′
+″ ″ ″
+‾ ‾ ‾
+⁄ ⁄ ⁄
+℘ ℘ ℘
+ℑ ℑ ℑ
+ℜ ℜ ℜ
+™ ™ ™
+ℵ ℵ ℵ
+← ← ←
+↑ ↑ ↑
+→ → →
+↓ ↓ ↓
+↔ ↔ ↔
+↵ ↵ ↵
+⇐ ⇐ ⇐
+⇑ ⇑ ⇑
+⇒ ⇒ ⇒
+⇓ ⇓ ⇓
+⇔ ⇔ ⇔
+∀ ∀ ∀
+∂ ∂ ∂
+∃ ∃ ∃
+∅ ∅ ∅
+∇ ∇ ∇
+∈ ∈ ∈
+∉ ∉ ∉
+∋ ∋ ∋
+∏ ∏ ∏
+∑ ∑ ∑
+− − −
+∗ ∗ ∗
+√ √ √
+∝ ∝ ∝
+∞ ∞ ∞
+∠ ∠ ∠
+∧ ∧ ∧
+∨ ∨ ∨
+∩ ∩ ∩
+∪ ∪ ∪
+∫ ∫ ∫
+∴ ∴ ∴
+∼ ∼ ∼
+≅ ≅ ≅
+≈ ≈ ≈
+≠ ≠ ≠
+≡ ≡ ≡
+≤ ≤ ≤
+≥ ≥ ≥
+⊂ ⊂ ⊂
+⊃ ⊃ ⊃
+⊄ ⊄ ⊄
+⊆ ⊆ ⊆
+⊇ ⊇ ⊇
+⊕ ⊕ ⊕
+⊗ ⊗ ⊗
+⊥ ⊥ ⊥
+⋅ ⋅ ⋅
+⌈ ⌈ ⌈
+⌉ ⌉ ⌉
+⌊ ⌊ ⌊
+⌋ ⌋ ⌋
+〈 〈 〈
+〉 〉 〉
+◊ ◊ ◊
+♠ ♠ ♠
+♣ ♣ ♣
+♥ ♥ ♥
+♦ ♦ ♦
+" " "
+& & &
+< < <
+> > >
+Œ Œ Œ
+œ œ œ
+Š Š Š
+š š š
+Ÿ Ÿ Ÿ
+ˆ ˆ ˆ
+˜ ˜ ˜
+  
+  
+  
+ ‌
+ ‍
+ ‎
+ ‏
+– – –
+— — —
+‘ ‘ ‘
+’ ’ ’
+‚ ‚ ‚
+“ “ “
+” ” ”
+„ „ „
+† † †
+‡ ‡ ‡
+‰ ‰ ‰
+‹ ‹ ‹
+› › ›
+€ € €
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libhtml-entities-numbered-perl.git
More information about the Pkg-perl-cvs-commits
mailing list