UseMod Wiki 1.0 already include WikiPatches/NumberedHeadings and WikiPatches/TableOfContents. User can use <toc> to generate TOC, and it use anchors to link to appropriate location. The anchors can be the abbreviations of the text of the headings, or numbers. But if two or more headings are the same, the anchors are the same too. It is even bad when write wiki page in mixed language such as Chinese with English. This patch give the user a choice to use numbered anchor instead of the text of the headings in <toc>.
--- wiki.pl 2003-09-11 20:21:02.000000000 +0800 +++ wiki.pl.numanchor 2003-11-16 21:35:28.218750000 +0800 @@ -53,7 +53,7 @@ @IsbnNames @IsbnPre @IsbnPost $EmailFile $FavIcon $RssDays $UserHeader $UserBody $StartUID $ParseParas $AuthorFooter $UseUpload $AllUpload $UploadDir $UploadUrl $LimitFileUrl $MaintTrimRc $SearchButton - $EditNameLink $UseMetaWiki @ImageSites $BracketImg ); + $EditNameLink $UseMetaWiki @ImageSites $BracketImg $UseNumberedAnchor); # Note: $NotifyDefault is kept because it was a config variable in 0.90 # Other global variables: use vars qw(%Page %Section %Text %InterSite %SaveUrl %SaveNumUrl @@ -175,6 +175,8 @@ $EditNameLink = 0; # 1 = edit links use name (CSS), 0 = '?' links $UseMetaWiki = 0; # 1 = add MetaWiki search links, 0 = no MW links $BracketImg = 1; # 1 = [url url.gif] becomes image link, 0 = no img +$UseNumberedAnchor = 1; # 1 = use numbered anchor in NumberedHeadings, + # 0 = cook anchor by canonicalizing text # Names of sites. (The first entry is used for the number link.) @IsbnNames = ('bn.com', 'amazon.com', 'search'); @@ -2116,12 +2119,15 @@ $text =~ s/\<a\s[^\>]*?\>\?\<\/a\>//si; # No such page syntax $text =~ s/\<a\s[^\>]*?\>(.*?)\<\/a\>/$1/si; # Cook anchor by canonicalizing $text. - $anchor = $text; - $anchor =~ s/\<.*?\>//g; - $anchor =~ s/\W/_/g; - $anchor =~ s/__+/_/g; - $anchor =~ s/^_//; - $anchor =~ s/_$//; + if (!$UseNumberedAnchor) + { + $anchor = $text; + $anchor =~ s/\<.*?\>//g; + $anchor =~ s/\W/_/g; + $anchor =~ s/__+/_/g; + $anchor =~ s/^_//; + $anchor =~ s/_$//; + } # Last ditch effort $anchor = '_' . (join '_', @HeadingNumbers) unless $anchor; $TableOfContents .= $number . &ScriptLink("$OpenPageName#$anchor",$text)
-- Johnson
TrentBuck?: Dunno if this is an issue, but valid HTML links must start with a character [A-Za-z_] (I think).
Bit-Man: This patch adds a setting, so it should change the config file too. Follows the patch to apply to config :-D
--- config.original 2003-09-05 16:03:12.000000000 -0300 +++ config.patched 2006-04-28 18:57:52.000000000 -0300 @@ -106,7 +106,9 @@ $EditNameLink = 0; # 1 = edit links use name (CSS), 0 = '?' links $UseMetaWiki = 0; # 1 = add MetaWiki search links, 0 = no MW links $BracketImg = 1; # 1 = [url url.gif] becomes image link, 0 = no img - +$UseNumberedAnchor = 1; # 1 = use numbered anchor in NumberedHeadings, + # 0 = cook anchor by canonicalizing text + # Names of sites. (The first entry is used for the number link.) @IsbnNames = ('bn.com', 'amazon.com', 'search'); # Full URL of each site before the ISBN