Change 30681 by [EMAIL PROTECTED] on 2007/03/22 09:28:15 Subject: [PATCH] Re: [PATCH] lib/Pod/Html.pm plus a funky UT8-8 regex bug From: Jarkko Hietaniemi <[EMAIL PROTECTED]> Date: Wed, 21 Mar 2007 08:01:14 -0400 Message-ID: <[EMAIL PROTECTED]>
Affected files ... ... //depot/perl/lib/Pod/Html.pm#89 edit Differences ... ==== //depot/perl/lib/Pod/Html.pm#89 (text) ==== Index: perl/lib/Pod/Html.pm --- perl/lib/Pod/Html.pm#88~30631~ 2007-03-19 02:34:32.000000000 -0700 +++ perl/lib/Pod/Html.pm 2007-03-22 02:28:15.000000000 -0700 @@ -2099,13 +2099,12 @@ my $orig = $text; - # just clean the punctuation and leave the words for the - # fragment identifier. - $text =~ s/([[:punct:]\s])+/$1/g; - $text =~ s/[[:punct:]\s]+\Z//g; - - # "=item --version", remove leading punctuation. - $text =~ s/^[-[:punct:]]//; + # leave the words for the fragment identifier, + # change everything else to underbars. + $text =~ s/[^A-Za-z0-9_]+/_/g; # do not use \W to avoid locale dependency. + $text =~ s/_{2,}/_/g; + $text =~ s/\A_//; + $text =~ s/_\Z//; unless ($text) { @@ -2129,11 +2128,11 @@ }} my @HC; -sub fragment_id_obfusticated { # This was the old "_2d_2d__" +sub fragment_id_obfuscated { # This was the old "_2d_2d__" my $text = shift; my $generate = shift; # optional flag - # text? Normalize by obfusticating the fragment id to make it unique + # text? Normalize by obfuscating the fragment id to make it unique $text =~ s/\s+/_/sg; $text =~ s{(\W)}{ @@ -2174,9 +2173,9 @@ return $1 if $text =~ m{^([a-z\d_]+)(\s+[A-Z,/& ][A-Z\d,/& ]*)?$}; return $1 if $text =~ m{^([a-z\d]+)\s+Module(\s+[A-Z\d,/& ]+)?$}; - fragment_id_readable($text, $generate); + return fragment_id_readable($text, $generate); } else { - return undef(); + return; } } End of Patch.