HTML-Entities-Numbered-0.04/ 0040755 0001765 0001751 00000000000 10115631327 015361 5 ustar taniguchi admin HTML-Entities-Numbered-0.04/t/ 0040755 0001765 0001751 00000000000 10115631327 015624 5 ustar taniguchi admin HTML-Entities-Numbered-0.04/t/06_invalid.t 0100644 0001765 0001751 00000000701 10106373466 017746 0 ustar taniguchi admin use strict;
use Test::More tests => 504;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
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;
HTML-Entities-Numbered-0.04/t/09_name2hex_xml.t 0100644 0001765 0001751 00000000562 10115630717 020712 0 ustar taniguchi admin use strict;
use Test::More tests => 252;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
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;
HTML-Entities-Numbered-0.04/t/01_name2decimal.t 0100644 0001765 0001751 00000000351 10106371465 020632 0 ustar taniguchi admin use strict;
use Test::More tests => 252;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
chomp;
my @entity = split /\t+/, $_;
ok(name2decimal($entity[0]) eq $entity[1]);
}
close ENT;
HTML-Entities-Numbered-0.04/t/04_hex2name.t 0100644 0001765 0001751 00000000345 10106371712 020021 0 ustar taniguchi admin use strict;
use Test::More tests => 252;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
chomp;
my @entity = split /\t+/, $_;
ok(hex2name($entity[2]) eq $entity[0]);
}
close ENT;
HTML-Entities-Numbered-0.04/t/07_cross.t 0100644 0001765 0001751 00000000676 10106374010 017447 0 ustar taniguchi admin use strict;
use Test::More tests => 1008;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
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;
HTML-Entities-Numbered-0.04/t/00_compile.t 0100644 0001765 0001751 00000000124 10106117046 017727 0 ustar taniguchi admin use strict;
use Test::More tests => 1;
BEGIN { use_ok 'HTML::Entities::Numbered' }
HTML-Entities-Numbered-0.04/t/03_decimal2name.t 0100644 0001765 0001751 00000000351 10106371655 020635 0 ustar taniguchi admin use strict;
use Test::More tests => 252;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
chomp;
my @entity = split /\t+/, $_;
ok(decimal2name($entity[1]) eq $entity[0]);
}
close ENT;
HTML-Entities-Numbered-0.04/t/02_name2hex.t 0100644 0001765 0001751 00000000345 10106371537 020024 0 ustar taniguchi admin use strict;
use Test::More tests => 252;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
chomp;
my @entity = split /\t+/, $_;
ok(name2hex($entity[0]) eq $entity[2]);
}
close ENT;
HTML-Entities-Numbered-0.04/t/05_hex2name_lc.t 0100644 0001765 0001751 00000000351 10106372031 020470 0 ustar taniguchi admin use strict;
use Test::More tests => 252;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
chomp;
my @entity = split /\t+/, $_;
ok(hex2name(lc($entity[2])) eq $entity[0]);
}
close ENT;
HTML-Entities-Numbered-0.04/t/entities.txt 0100644 0001765 0001751 00000013224 10106370154 020206 0 ustar taniguchi admin
¡ ¡ ¡
¢ ¢ ¢
£ £ £
¤ ¤ ¤
¥ ¥ ¥
¦ ¦ ¦
§ § §
¨ ¨ ¨
© © ©
ª ª ª
« « «
¬ ¬ ¬
® ® ®
¯ ¯ ¯
° ° °
± ± ±
² ² ²
³ ³ ³
´ ´ ´
µ µ µ
¶ ¶ ¶
· · ·
¸ ¸ ¸
¹ ¹ ¹
º º º
» » »
¼ ¼ ¼
½ ½ ½
¾ ¾ ¾
¿ ¿ ¿
À À À
Á Á Á
  Â
à à Ã
Ä Ä Ä
Å Å Å
Æ Æ Æ
Ç Ç Ç
È È È
É É É
Ê Ê Ê
Ë Ë Ë
Ì Ì Ì
Í Í Í
Î Î Î
Ï Ï Ï
Ð Ð Ð
Ñ Ñ Ñ
Ò Ò Ò
Ó Ó Ó
Ô Ô Ô
Õ Õ Õ
Ö Ö Ö
× × ×
Ø Ø Ø
Ù Ù Ù
Ú Ú Ú
Û Û Û
Ü Ü Ü
Ý Ý Ý
Þ Þ Þ
ß ß ß
à à à
á á á
â â â
ã ã ã
ä ä ä
å å å
æ æ æ
ç ç ç
è è è
é é é
ê ê ê
ë ë ë
ì ì ì
í í í
î î î
ï ï ï
ð ð ð
ñ ñ ñ
ò ò ò
ó ó ó
ô ô ô
õ õ õ
ö ö ö
÷ ÷ ÷
ø ø ø
ù ù ù
ú ú ú
û û û
ü ü ü
ý ý ý
þ þ þ
ÿ ÿ ÿ
ƒ ƒ ƒ
Α Α Α
Β Β Β
Γ Γ Γ
Δ Δ Δ
Ε Ε Ε
Ζ Ζ Ζ
Η Η Η
Θ Θ Θ
Ι Ι Ι
Κ Κ Κ
Λ Λ Λ
Μ Μ Μ
Ν Ν Ν
Ξ Ξ Ξ
Ο Ο Ο
Π Π Π
Ρ Ρ Ρ
Σ Σ Σ
Τ Τ Τ
Υ Υ Υ
Φ Φ Φ
Χ Χ Χ
Ψ Ψ Ψ
Ω Ω Ω
α α α
β β β
γ γ γ
δ δ δ
ε ε ε
ζ ζ ζ
η η η
θ θ θ
ι ι ι
κ κ κ
λ λ λ
μ μ μ
ν ν ν
ξ ξ ξ
ο ο ο
π π π
ρ ρ ρ
ς ς ς
σ σ σ
τ τ τ
υ υ υ
φ φ φ
χ χ χ
ψ ψ ψ
ω ω ω
ϑ ϑ ϑ
ϒ ϒ ϒ
ϖ ϖ ϖ
• • •
… … …
′ ′ ′
″ ″ ″
‾ ‾ ‾
⁄ ⁄ ⁄
℘ ℘ ℘
ℑ ℑ ℑ
ℜ ℜ ℜ
™ ™ ™
ℵ ℵ ℵ
← ← ←
↑ ↑ ↑
→ → →
↓ ↓ ↓
↔ ↔ ↔
↵ ↵ ↵
⇐ ⇐ ⇐
⇑ ⇑ ⇑
⇒ ⇒ ⇒
⇓ ⇓ ⇓
⇔ ⇔ ⇔
∀ ∀ ∀
∂ ∂ ∂
∃ ∃ ∃
∅ ∅ ∅
∇ ∇ ∇
∈ ∈ ∈
∉ ∉ ∉
∋ ∋ ∋
∏ ∏ ∏
∑ ∑ ∑
− − −
∗ ∗ ∗
√ √ √
∝ ∝ ∝
∞ ∞ ∞
∠ ∠ ∠
∧ ∧ ∧
∨ ∨ ∨
∩ ∩ ∩
∪ ∪ ∪
∫ ∫ ∫
∴ ∴ ∴
∼ ∼ ∼
≅ ≅ ≅
≈ ≈ ≈
≠ ≠ ≠
≡ ≡ ≡
≤ ≤ ≤
≥ ≥ ≥
⊂ ⊂ ⊂
⊃ ⊃ ⊃
⊄ ⊄ ⊄
⊆ ⊆ ⊆
⊇ ⊇ ⊇
⊕ ⊕ ⊕
⊗ ⊗ ⊗
⊥ ⊥ ⊥
⋅ ⋅ ⋅
⌈ ⌈ ⌈
⌉ ⌉ ⌉
⌊ ⌊ ⌊
⌋ ⌋ ⌋
〈 〈 〈
〉 〉 〉
◊ ◊ ◊
♠ ♠ ♠
♣ ♣ ♣
♥ ♥ ♥
♦ ♦ ♦
" " "
& & &
< < <
> > >
Œ Œ Œ
œ œ œ
Š Š Š
š š š
Ÿ Ÿ Ÿ
ˆ ˆ ˆ
˜ ˜ ˜
– – –
— — —
‘ ‘ ‘
’ ’ ’
‚ ‚ ‚
“ “ “
” ” ”
„ „ „
† † †
‡ ‡ ‡
‰ ‰ ‰
‹ ‹ ‹
› › ›
€ € €
HTML-Entities-Numbered-0.04/t/08_name2decimal_xml.t 0100644 0001765 0001751 00000000554 10115630416 021520 0 ustar taniguchi admin use strict;
use Test::More tests => 252;
use HTML::Entities::Numbered;
open(ENT, 't/entities.txt') || die $!;
while () {
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;
HTML-Entities-Numbered-0.04/lib/ 0040755 0001765 0001751 00000000000 10115631327 016127 5 ustar taniguchi admin HTML-Entities-Numbered-0.04/lib/HTML/ 0040755 0001765 0001751 00000000000 10115631327 016673 5 ustar taniguchi admin HTML-Entities-Numbered-0.04/lib/HTML/Entities/ 0040755 0001765 0001751 00000000000 10115631327 020457 5 ustar taniguchi admin HTML-Entities-Numbered-0.04/lib/HTML/Entities/Numbered/ 0040755 0001765 0001751 00000000000 10115631327 022220 5 ustar taniguchi admin HTML-Entities-Numbered-0.04/lib/HTML/Entities/Numbered/Table.pm 0100644 0001765 0001751 00000013672 10115604075 023613 0 ustar taniguchi admin package HTML::Entities::Numbered::Table;
use strict;
use vars qw($VERSION %DECIMALS @EXPORT);
use base qw(Exporter);
@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
=head1 DESCRIPTION
HTML::Entities::Numbered::Table is HTML entities table. The table is
including every named entity and decimal pairs.
=head1 AUTHOR
Koichi Taniguchi Etaniguchi@livedoor.jpE
=cut
HTML-Entities-Numbered-0.04/lib/HTML/Entities/Numbered.pm 0100644 0001765 0001751 00000014165 10115630124 022554 0 ustar taniguchi admin package HTML::Entities::Numbered;
use strict;
use HTML::Entities::Numbered::Table;
use base qw(Exporter);
use vars qw($VERSION @EXPORT %DECIMALS %ENTITIES);
@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;')/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;') }ieg;
return $content;
}
sub decimal2name {
my $content = shift;
$content =~ s/(\d+;)/_convert2name($1)/ieg;
return $content;
}
sub hex2name {
my $content = shift;
$content =~ s/([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♥';
# convert named HTML entities to numbered (decimal)
$decimal = name2decimal($html); # Hi Honey♥
# to numbered (hexadecimal)
$hex = name2hex($html); # Hi Honey♥
$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 or C contains some
B HTML entities, they will be replaced to numbered HTML
entities. And when an argument of C or
C contains some B numbered HTML entities,
they will be replaced to numbered HTML entities B (the excepted "valid XML entities" are the following five
entities: C<<>, C<>>, C<&>, C<">, C<'>).
By the same token, when an argument of C or
C contains some B 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 (with obsolete class
C for older releases of Perl).
At the moment, 0.04 (or later) is included
L to import HTML entities table, and
thereby we do not need to have L (included in
L 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
will be replaced to decimal numbered HTML entities.
=item * name2hex
Some included named HTML entities in argument of C
will be replaced to hexadecimal numbered HTML entities.
=item * decimal2name
Some include decimal numbered HTML entities in argument of
C will be replaced to named HTML entities
(If they're nameable).
=item * hex2name
Some include hexadecimal numbered HTML entities in argument of
C will be replaced to named HTML entities
(If they're nameable).
=item * name2decimal_xml
Some included named HTML entities in argument of C
will be replaced to decimal numbered HTML entities B.
=item * name2hex_xml
Some included named HTML entities in argument of C
will be replaced to hexadecimal numbered HTML entities B.
=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 Etaniguchi@livedoor.jpE
Develop triggered by IKEBE Tomohiro Eikebe@cpan.orgE
Many thanks to Tatsuhiko Miyagawa Emiyagawa@cpan.orgE
=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,
L
=cut
HTML-Entities-Numbered-0.04/META.yml 0100644 0001765 0001751 00000000560 10115631326 016627 0 ustar taniguchi admin # 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
HTML-Entities-Numbered-0.04/Changes 0100644 0001765 0001751 00000000664 10115630252 016653 0 ustar taniguchi admin 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
HTML-Entities-Numbered-0.04/MANIFEST 0100644 0001765 0001751 00000000613 10115631327 016507 0 ustar taniguchi admin 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)
HTML-Entities-Numbered-0.04/Makefile.PL 0100644 0001765 0001751 00000000331 10115622155 017324 0 ustar taniguchi admin use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'HTML::Entities::Numbered',
VERSION_FROM => 'lib/HTML/Entities/Numbered.pm', # finds $VERSION
PREREQ_PM => {
'Test::More' => 0.32,
},
);
HTML-Entities-Numbered-0.04/README 0100644 0001765 0001751 00000011426 10115630171 016236 0 ustar taniguchi admin HTML::Entities::Numbered version 0.04
=====================================
NAME
HTML::Entities::Numbered - Conversion of numbered HTML entities
SYNOPSIS
use HTML::Entities::Numbered;
$html = 'Hi Honey♥';
# convert named HTML entities to numbered (decimal)
$decimal = name2decimal($html); # Hi Honey♥
# to numbered (hexadecimal)
$hex = name2hex($html); # Hi Honey♥
$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
Develop triggered by IKEBE Tomohiro
Many thanks to Tatsuhiko Miyagawa
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,