ribbo****@users*****
ribbo****@users*****
2008年 9月 16日 (火) 17:12:26 JST
Index: docs/modules/HTML-Entities-3.55/Entities.pod diff -u /dev/null docs/modules/HTML-Entities-3.55/Entities.pod:1.1 --- /dev/null Tue Sep 16 17:12:26 2008 +++ docs/modules/HTML-Entities-3.55/Entities.pod Tue Sep 16 17:12:26 2008 @@ -0,0 +1,129 @@ +=head1 åå + +HTML::Entities - HTMLã¨ã³ãã£ãã£(å®ä½åç §)æååãã¨ã³ã³ã¼ã/ãã³ã¼ããã + +=head1 æ¦è¦ + + use HTML::Entities; + + $a = "Våre norske tegn bør æres"; + decode_entities($a); + encode_entities($a, "\200-\377"); + +以ä¸ã¯ä¾ã§ãã: + + $input = "vis-à -vis Beyoncé's naïve\npapier-mâché résumé"; + print encode_entities($input), "\n" + +çµæã¯ä»¥ä¸ã®ããã«ãªã: + + vis-à-vis Beyoncé's naïve + papier-mâché résumé + +=head1 説æ + +ãã®ã¢ã¸ã¥ã¼ã«ã¯ãHTMLæåã¨ã³ãã£ãã£(å®ä½åç §)ã®ã¨ã³ã³ã¼ãã¨ãã³ã¼ã +ãåãæ±ãããã®ã¢ã¸ã¥ã¼ã«ã¯ä»¥ä¸ã®æ©è½ãæä¾ãã: + +=over 4 + +=item decode_entities( $string, ... ) + +ãã®ã«ã¼ãã³ã¯å¯¾å¿ããã¦ãã³ã¼ãæåãå«ã $string ä¸ã®HTMLã¨ã³ãã£ã㣠+ãç½®ãæãããperl 5.6 ã¨ãã以åã§ã¯ãLatin-1ã®ç¯å²ã®æåã®ã¿ãç½®ãæã +ããããèªèã§ããªãã¨ã³ãã£ãã£ã¯ãã®ã¾ã¾æ®ãã + +ããããå¼æ°ã¨ãã¦è¤æ°ã®æååãæä¾ãããå ´åããããã¯åå¥ã«ãã³ã¼ã +ãããåãæ°ã®æååãè¿ãã + +ããããvoidã³ã³ããã¹ããå¼ã°ããå ´åãå¼æ°ã¯ãã®å ´ã§ãã³ã¼ããããã + +ãã®ã«ã¼ãã³ã¯è¦å®å¤ã§ã¨ã¯ã¹ãã¼ããããã + +=item _decode_entities( $string, \%entity2char ) + +=item _decode_entities( $string, \%entity2char, $expand_prefix ) + +ããã¯ã$stringä¸ã®HTMLã¨ã³ãã£ãã£ããã®å ´ã§ç½®ãæããã%entiti2char +ããã·ã¥ãæä¾ãããªããã°ãªããªãã%entity2charä¸ã«è¦ã¤ãããªããåå +ãä»ããã¨ã³ãã£ãã£ã¯ãã®ã¾ã¾æ®ããæ°åã®ã¨ã³ãã£ãã£ã¯ãã®å¤ããªã¼ã +ããã¼ããã¾ã§æ¡å¼µãããã + +%entity2charä¸ã®ãã¼ã¯æ¡å¼µãããã¨ã³ãã£ãã£åã§ããã®å¤ã¯æ¡å¼µãããã¹ã +ãã®ã§ããããã®å¤ã¯åä¸æåã®ã®æååã§ãã£ã¦ã¯ãªããªããããããã¼ã +ãµãã£ãã¯ã¹ã¨ãã¦";"ãæã£ã¦ãããªãã°ã$stringä¸ã«è¦ã¤ãããã®ã¯ã +ãããé©åã«";"ã§çµäºãã¦ãããªãã°ãããã®ã¿æ¡å¼µãããã";"ãæããªã +ã¨ã³ãã£ãã£ã¯ãå ±éã®ãã©ã¦ã¶ããLatin-1ã®ç¯å²ä¸ã§ã¨ã³ãã£ãã£ãåãæ±ã +ã³ã³ããããªãã£ã®ããã«ã©ã®ããã«çµäºããã¨ãã¦ãã¦ããæ¡å¼µãããã + +ãããã$expand_prefix ã TRUE ã§ããã°ã%entity2charä¸ã®ãæ«å°¾ã®";"ãªãã® +ã¨ã³ãã£ãã£ã¯ããé·ãèªèãããªãååã®ãã¬ãã£ãã¯ã¹ã¨ãã¦ãæ¡å¼µãããã +%entity2charä¸ã®ããã£ã¨ãé·ãä¸è´ããååã使ããããããã¯ã主ã«ãMSIE +ã®ééã£ãæ©è½ã«å¯¾ããäºæã®ããã«æä¾ããã¦ããã + + $string = "foo bar"; + _decode_entities($string, { nb => "@", nbsp => "\xA0" }, 1); + print $string; # will print "foo bar" + +ãã®ã«ã¼ãã³ã¯è¦å®å¤ã§ã¨ã¯ã¹ãã¼ããããã + +=item encode_entities( $string ) + +=item encode_entities( $string, $unsafe_chars ) + +ãã®ã«ã¼ãã³ã¯ã¨ã³ãã£ãã£ã®è¡¨ç¾ã¨å ±ã« $stringä¸ã®å®å ¨ã§ãªãæåã +ç½®ãæããã2çªç®ã®å¼æ°ã¯ãã©ã®æåãå®å ¨ã§ãªãã¨èããããããæä¾ãã +ãã¨ãåºæ¥ã(ãã¨ãã°ãã©ããã¨ã¹ã±ã¼ãããã)ãã¨ã³ã³ã¼ããããè¦å®å¤ +ã®æåã»ããã¯ãã³ã³ããã¼ã«æåã8ãããç®ãè¨å®ããã¦ããæå㨠+C<< < >>, C<< & >>, C<< > >>, C<< ' >> 㨠C<< " >> ã§ããããããã +ããã¯ãä¾ããããã¨ãC<< < >>, C<< & >>, C<< > >>, C<< ' >> 㨠C<< " >> +ã¯ä»¥ä¸ã®ãããªå½¢ã§ã¨ã³ã³ã¼ãã§ããã + + $encoded = encode_entities($input, '<>&"'); + +ãã®ã«ã¼ãã³ã¯è¦å®å¤ã§ã¨ã¯ã¹ãã¼ããããã + +=item encode_entities_numeric( $string ) + +=item encode_entities_numeric( $string, $unsafe_chars ) + +ãã®ã«ã¼ãã³ã¯ãencode_entitiesã¨åãããã«åä½ããããç½®æã¨ã³ãã£ã㣠+ã¯å¸¸æC<&#xI<hexnum>;>ã¨ãªãã決ãã¦C<&I<entname>;>ã«ãªããªãã¨ããã +éããä¾ããããã¨ã C<encode_entities("r\xF4le")> 㯠"rôle" ã +è¿ãããC<encode_entities_numeric("r\xF4le")>ã¯"rôle"ãè¿ãã + +ãã®ã«ã¼ãã³ã¯è¦å®å¤ã§ã¯ã¨ã¯ã¹ãã¼ãI<ãããªã>ããããã + C<use HTML::Entities qw(encode_entities_numeric);>ãã +C<use HTML::Entities qw(:DEFAULT encode_entities_numeric);> +ã§å¸¸ã«ã¨ã¯ã¹ãã¼ããããã¨ãåºæ¥ãã + +=back + +ä¸è¨ã®ãã¹ã¦ã®ã«ã¼ãã³ã¯ãããããvoid ã³ã³ããã¹ãã¨ãã¦å¼ã°ããå ´åã +æåã®å¼æ°ã¨ãã¦æ¸¡ãããæååãå¤æ´ãããã¹ã«ã©ã¼ã¾ãã¯é åã³ã³ããã¹ã +ä¸ã§ã¯ãã¨ã³ã³ã¼ãã¾ãã¯ãã³ã¼ããããæååãæ»ã(å ¥åæååã®å¤æ´ +ãªãã«)ã + +ããããåå空éã«ãããã®ã«ã¼ãã³ãã¤ã³ãã¼ãããããªãã®ã§ããã°ã +ãããã以ä¸ã®ããã«å¼ã³åºããã¨ãåºæ¥ã: + + use HTML::Entities (); + $decoded = HTML::Entities::decode($a); + $encoded = HTML::Entities::encode($a); + $encoded = HTML::Entities::encode_numeric($a); + + +ãããã®ã¢ã¸ã¥ã¼ã«ã¯ã対å¿ããã¨ã³ãã£ãã£(ã¨éãã¾ãåæ§)ã®ããã® +ãã¹ã¦ã®æååããã®ãããã³ã°ãå«ã $char2entityã¨%entity2charããã·ã¥ +ããã¨ã¯ã¹ãã¼ããããã¨ãåºæ¥ãã + +=head1 COPYRIGHT + +Copyright 1995-2006 Gisle Aas. All rights reserved. + +This library is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + + +=cut +