summaryrefslogtreecommitdiff
path: root/lib/Pod
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2007-03-21 04:01:14 -0400
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-03-22 09:28:15 +0000
commitc24033b9cf73473ddef37d0a45d2c56f24f44fc9 (patch)
tree27bc789fc1aaa71d62674c27c7d9930d6c4624b2 /lib/Pod
parent6483fb35cd05d1e5ad8270387a883096b0ab1c38 (diff)
downloadperl-c24033b9cf73473ddef37d0a45d2c56f24f44fc9.tar.gz
Re: [PATCH] lib/Pod/Html.pm plus a funky UT8-8 regex bug
Message-ID: <46011E8A.1080009@iki.fi> p4raw-id: //depot/perl@30681
Diffstat (limited to 'lib/Pod')
-rw-r--r--lib/Pod/Html.pm21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/Pod/Html.pm b/lib/Pod/Html.pm
index 9955d3463f..b17a84403a 100644
--- a/lib/Pod/Html.pm
+++ b/lib/Pod/Html.pm
@@ -2099,13 +2099,12 @@ sub fragment_id_readable {
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 @@ sub fragment_id_readable {
}}
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 @@ sub fragment_id {
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;
}
}