Commits

Toby Inkster committed 326e6cd

release 0.001

Comments (0)

Files changed (4)

HTML-HTML5-Entities-0.001.tar.gz

Binary file added.

lib/HTML/HTML5/Entities.pm

 {
 	$hex       = 1;
 	@EXPORT    = qw(encode_entities decode_entities _decode_entities);
-	@EXPORT_OK = qw(%entity2char %char2entity encode_entities_numeric);
+	@EXPORT_OK = qw(%entity2char %char2entity encode_entities_numeric num_entity);
 	
 	$default_unsafe_characters = qr/[^\w\n\r\t !\#\$%\(-;=?-~]/x;
 
 			elsif (defined $3)
 				{ chr(hex $3); }
 			elsif (defined $_[2] and $_[2])
-				{ $map{$2} || _search_entity($4, \%map); }
+				{ $map{$4} || _search_entity($4, \%map); }
 			else
 				{ $map{$4} || $1; }
 		/xeg;
 
 =head1 SYNOPSIS
 
-	use HTML::Entities;
-	
-	my $enc = encode_entities('fish & chips');
-	print "$enc\n";   # fish & chips
-	
-	my $dec = decode_entities($enc);
-	print "$dec\n";   # fish & chips
+ use HTML::Entities;
+ 
+ my $enc = encode_entities('fish & chips');
+ print "$enc\n";   # fish & chips
+ 
+ my $dec = decode_entities($enc);
+ print "$dec\n";   # fish & chips
 
 =head1 DESCRIPTION
 
 C<< %entity2char >> will even be expanded as a prefix of a longer
 unrecognized name.
 
-	$string = "foo&nbspbar";
-	_decode_entities($string, { nb => "@", nbsp => "\xA0" }, 1);
-	print $string;  # will print "foo bar"
+ $string = "foo&nbspbar";
+ _decode_entities($string, { nb => "@", nbsp => "\xA0" }, 1);
+ print $string;  # will print "foo bar"
 
 This routine is exported by default.
 
 =item C<< encode_entities($string) >>
+
 =item C<< encode_entities($string, $unsafe_chars) >>
 
 This routine replaces unsafe characters in C<< $string >> with their
 
 This routine is not exported by default.
 
+=item C<< num_entity($string) >>
+
+Given a single character string, encodes it as a numeric entity.
+
+This routine is not exported by default.
+
+=back
+
+The following functions cannot be exported. They behave the same as the
+exportable functions.
+
+=over
+
+=item C<< HTML::Entities::decode($string, ...) >>
+
+=item C<< HTML::Entities::encode($string) >>
+
+=item C<< HTML::Entities::encode($string, $unsafe_characters) >>
+
+=item C<< HTML::Entities::encode_numeric($string) >>
+
+=item C<< HTML::Entities::encode_numeric($string, $unsafe_characters) >>
+
+=item C<< HTML::Entities::encode_numerically($string) >>
+
+=item C<< HTML::Entities::encode_numerically($string, $unsafe_characters) >>
+
 =back
 
 =head2 Variables
 dist:project :release dist:v_0-001 .
 dist:v_0-001
 	a               :Version ;
-	dc:issued       "2011-10-06"^^xsd:date ;
+	dc:issued       "2011-10-07"^^xsd:date ;
 	:revision       "0.001"^^xsd:string ;
 	:file-release   <http://backpan.cpan.org/authors/id/T/TO/TOBYINK/HTML-HTML5-Entities-0.001.tar.gz> ;
 	rdfs:label      "Initial release" .
 	a               :Project ;
 	:programming-language "Perl" ;
 	:name           "HTML-HTML5-Entities" ;
-	:shortdesc      "a module that does something-or-other" ;
+	:shortdesc      "drop-in replacement for HTML::Entities" ;
 	:homepage       <https://metacpan.org/release/HTML-HTML5-Entities> ;
 	:download-page  <https://metacpan.org/release/HTML-HTML5-Entities> ;
 	:bug-database   <http://rt.cpan.org/Dist/Display.html?Queue=HTML-HTML5-Entities> ;