Change 15259 by jhi@alpha on 2002/03/16 17:58:08
Subject: [PATCH lib/Pod/Html.pm] fix anchor generation code (ID 20020312.006)
From: Stas Bekman <[EMAIL PROTECTED]>
Date: Sun, 17 Mar 2002 02:11:26 +0800 (SGT)
Message-ID: <[EMAIL PROTECTED]>
Affected files ...
.... //depot/perl/lib/Pod/Html.pm#55 edit
Differences ...
==== //depot/perl/lib/Pod/Html.pm#55 (text) ====
Index: perl/lib/Pod/Html.pm
--- perl/lib/Pod/Html.pm.~1~ Sat Mar 16 11:15:05 2002
+++ perl/lib/Pod/Html.pm Sat Mar 16 11:15:05 2002
@@ -1055,8 +1055,7 @@
print HTML "</p>\n";
}
- my $name = htmlify( depod( $heading ) );
- $name =~ s/\s/_/g; # htmlify keeps spaces but we don't want them here...
+ my $name = anchorify( depod( $heading ) );
my $convert = process_text( \$heading );
print HTML "<h$level><a name=\"$name\">$convert</a></h$level>\n";
}
@@ -1079,8 +1078,8 @@
if ($items_named{$item}++) {
print HTML process_text( \$otext );
} else {
- my $name = 'item_' . $item;
- $name =~ s/\s/_/g; # we don't want spaces here...
+ my $name = 'item_' . $item;
+ $name = anchorify($name);
print HTML qq{<a name="$name">}, process_text( \$otext ), '</a>';
}
print HTML "</strong><br />\n";
@@ -1733,7 +1732,7 @@
$page83=dosify($page);
$page=$page83 if (defined $pages{$page83});
if ($page eq "") {
- $link = "#" . htmlify( $section );
+ $link = "#" . anchorify( $section );
} elsif ( $page =~ /::/ ) {
$page =~ s,::,/,g;
# Search page cache for an entry keyed under the html page name,
@@ -1760,11 +1759,11 @@
}
$link = "$htmlroot/$page.html";
- $link .= "#" . htmlify( $section ) if ($section);
+ $link .= "#" . anchorify( $section ) if ($section);
} elsif (!defined $pages{$page}) {
$link = "";
} else {
- $section = htmlify( $section ) if $section ne "";
+ $section = anchorify( $section ) if $section ne "";
### print STDERR "...section=$section\n";
# if there is a directory by the name of the page, then assume that an
@@ -1947,6 +1946,16 @@
}
#
+# similar to htmlify, but turns spaces into underscores
+#
+sub anchorify {
+ my ($anchor) = @_;
+ $anchor = htmlify($anchor);
+ $anchor =~ s/\s/_/g; # fixup spaces left by htmlify
+ return $anchor;
+}
+
+#
# depod - convert text by eliminating all interior sequences
# Note: can be called with copy or modify semantics
#
End of Patch.