1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | 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@livedoor.jp> Develop triggered by IKEBE Tomohiro <ikebe@cpan.org> Many thanks to Tatsuhiko Miyagawa <miyagawa@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> |
Commit History @1bcdbe6b-c58d-4d85-9588-c8ca0bdbe9c7/main
0
»»
- debian/watch: use uscan version 4. gregor herrmann 4 years ago
- update changelog gregor herrmann 5 years ago
- debian/*: update URLs from {search,www}.cpan.org to MetaCPAN. gregor herrmann 5 years ago
- update changelog Salvatore Bonaccorso 6 years ago
- Update Vcs-* headers for switch to salsa.debian.org Salvatore Bonaccorso 6 years ago
- update changelog gregor herrmann 7 years ago
- debian/copyright: change Copyright-Format 1.0 URL to HTTPS. gregor herrmann 7 years ago
- releasing package libhtml-entities-numbered-perl version 0.04-2 Dominic Hargreaves 8 years ago
- Modernize copyright file Dominic Hargreaves 8 years ago
- Update Standards-Version (no changes) Dominic Hargreaves 8 years ago
- Remove inappropriate dependencies on perl-modules Dominic Hargreaves 8 years ago
- Switch to minimal dh style rules Dominic Hargreaves 8 years ago
- Switch to dpkg-source 3.0 (quilt) format Dominic Hargreaves 8 years ago
- Update Homepage and Vcs-* fields Dominic Hargreaves 8 years ago
- Change Maintainer to Debian Perl Group Dominic Hargreaves 8 years ago
- [svn-inject] Applying Debian modifications to trunk Dominic Hargreaves 16 years ago
- [svn-inject] Forking libhtml-entities-numbered-perl source to Trunk Dominic Hargreaves 16 years ago
- [svn-inject] Installing original source of libhtml-entities-numbered-perl Dominic Hargreaves 16 years ago
0
»»