Skip to content

Commit

Permalink
modernized entity handling in Mojo::Util a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Mar 17, 2013
1 parent 07a19fd commit 2e0dd08
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/Mojo/Util.pm
Expand Up @@ -23,12 +23,9 @@ use constant {
# To update HTML5 entities run this command
# perl examples/entities.pl > lib/Mojo/entities.txt
my %ENTITIES;
{
open my $entities, '<', catfile(dirname(__FILE__), 'entities.txt');
for my $entity (<$entities>) {
next unless $entity =~ /^(\S+)\s+U\+(\S+)(?:\s+U\+(\S+))?/;
$ENTITIES{$1} = defined $3 ? (chr(hex $2) . chr(hex $3)) : chr(hex $2);
}
for my $line (split "\x0a", slurp(catfile dirname(__FILE__), 'entities.txt')) {
next unless $line =~ /^(\S+)\s+U\+(\S+)(?:\s+U\+(\S+))?/;
$ENTITIES{$1} = defined $3 ? (chr(hex $2) . chr(hex $3)) : chr(hex $2);
}

# DEPRECATED in Rainbow!
Expand Down

0 comments on commit 2e0dd08

Please sign in to comment.