summaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-03-07 09:48:59 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2007-03-07 09:48:59 +0000
commitb365d864c507c9f6e3374c1fb7c854ddb495aeae (patch)
treee8e4f848c6374d64394421a3c0b28da622896ba3 /IkiWiki.pm
parentb39495f5015d0e5037db7682a2dc625abb26c5b8 (diff)
My fix to support encoded underscores in page titles broke links to pages
with underscores in their filenames, since the link code also used titlepage. Create a new linkpage function and have the link code use that instead.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm12
1 files changed, 10 insertions, 2 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 763f24e6c..385d16a56 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -376,6 +376,12 @@ sub titlepage ($) { #{{{
return $title;
} #}}}
+sub linkpage ($) { #{{{
+ my $link=shift;
+ $link=~s/([^-[:alnum:]:+\/._])/$1 eq ' ' ? '_' : "__".ord($1)."__"/eg;
+ return $link;
+} #}}}
+
sub cgiurl (@) { #{{{
my %params=@_;
@@ -422,6 +428,8 @@ sub htmllink ($$$;@) { #{{{
my $link=shift;
my %opts=@_;
+print STDERR "bestlink $lpage $link\n" if $lpage eq "roadmap" && $link =~/rcs/;
+
my $bestlink;
if (! $opts{forcesubpage}) {
$bestlink=bestlink($lpage, $link);
@@ -496,8 +504,8 @@ sub linkify ($$$) { #{{{
$content =~ s{(\\?)$config{wiki_link_regexp}}{
defined $2
- ? ( $1 ? "[[$2|$3]]" : htmllink($lpage, $page, titlepage($3), anchor => $4, linktext => pagetitle($2)))
- : ( $1 ? "[[$3]]" : htmllink($lpage, $page, titlepage($3), anchor => $4))
+ ? ( $1 ? "[[$2|$3]]" : htmllink($lpage, $page, linkpage($3), anchor => $4, linktext => pagetitle($2)))
+ : ( $1 ? "[[$3]]" : htmllink($lpage, $page, linkpage($3), anchor => $4))
}eg;
return $content;