HTML::...mbered(3pm)
β¨ NAME β¨
okay bestie, welcome to HTML::Entities::Numbered π (that's the manual name, she's a Perl module, and she converts numbered HTML entities β that's literally the whole job, she's so valid for that)
π¦ SYNOPSIS π¦
real talk, here's the vibe in code:
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♠
likeβ¦ look at her go π
πΈ DESCRIPTION πΈ
HTML::Entities::Numbered is a content conversion filter for named HTML entities β we're talking symbols, mathmetical symbols, Greek letters, Latin letters, etc. the whole cute little alphabet of entities π₯
so here's the tea:
- when an argument of
name2decimal()orname2hex()contains some nameable HTML entities, they will be replaced to numbered HTML entities. - and when an argument of
name2decimal_xml()orname2hex_xml()contains some nameable numbered HTML entities, they will be replaced to numbered HTML entities except valid XML entities. no cap. and what are those excepted "valid XML entities"? it's these five, bestie:<,>,&,",'. - by the same token, when an argument of
decimal2name()orhex2name()contains some nameable numbered HTML entities, they will be replaced to named HTML entities.
(and yes, to say it again because it matters: the exception "valid XML entities" means the following five entities: <, >, &, ", ')
okay now the lore π§ 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). but 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). glow up fr fr β¨
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. yes, all of them, she's generous like that π«Ά
name2decimalβ some included named HTML entities in argument ofname2decimal()will be replaced to decimal numbered HTML entities.name2hexβ some included named HTML entities in argument ofname2hex()will be replaced to hexadecimal numbered HTML entities.decimal2nameβ some include decimal numbered HTML entities in argument ofdecimal2name()will be replaced to named HTML entities (If they're nameable).hex2nameβ some include hexadecimal numbered HTML entities in argument ofhex2name()will be replaced to named HTML entities (If they're nameable).name2decimal_xmlβ some included named HTML entities in argument ofname2decimal_xml()will be replaced to decimal numbered HTML entities except valid XML entities.name2hex_xmlβ some included named HTML entities in argument ofname2hex_xml()will be replaced to hexadecimal numbered HTML entities except valid XML entities.
and if you'd prefer not to import them functions into the caller's namespace (valid, lowkey respecting your space π), 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@livedoor.jp>
Develop triggered by IKEBE Tomohiro <ikebe@cpan.org>
Many thanks to Tatsuhiko Miyagawa <miyagawa@cpan.org> β we love a shoutout π«Ά
π 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>
and that's the whole page bestie π
this was HTML::...mbered(3pm) from perl v5.36.0, dated 2022-10-22 β¨ she ate and left no crumbs, go convert some entities π¦π
π¦ where this page comes from
- ubuntu noble: libhtml-entities-numbered-perl 0.04-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libhtml-entities-numbered-perl 0.04-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libhtml-entities-numbered-perl 0.04-4 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms