aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/link.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-23 18:57:27 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-23 18:57:27 -0400
commit8b063a24d909bfac056668f00513bf92f6f17817 (patch)
tree63a84e358354011f2e7ef8029028e771770762bb /IkiWiki/Plugin/link.pm
parent4691a2ad39cce273231fddd9a589b4f8fdc1b063 (diff)
downloadikiwiki-8b063a24d909bfac056668f00513bf92f6f17817.tar
ikiwiki-8b063a24d909bfac056668f00513bf92f6f17817.tar.gz
case preservation
Diffstat (limited to 'IkiWiki/Plugin/link.pm')
-rw-r--r--IkiWiki/Plugin/link.pm15
1 files changed, 10 insertions, 5 deletions
diff --git a/IkiWiki/Plugin/link.pm b/IkiWiki/Plugin/link.pm
index 51afaec9e..e20109888 100644
--- a/IkiWiki/Plugin/link.pm
+++ b/IkiWiki/Plugin/link.pm
@@ -11,6 +11,7 @@ sub import { #{{{
hook(type => "checkconfig", id => "link", call => \&checkconfig);
hook(type => "linkify", id => "link", call => \&linkify);
hook(type => "scan", id => "link", call => \&scan);
+ hook(type => "renamepage", id => "link", call => \&renamepage);
} # }}}
sub checkconfig () { #{{{
@@ -87,13 +88,17 @@ sub renamepage (@) { #{{{
my $new=$params{newpage};
$params{content} =~ s{(?<!\\)$link_regexp}{
- my $link=$2;
+ my $linktext=$2;
+ my $link=$linktext;
if (bestlink($page, $2) eq $old) {
- if (index($2, "/") == 0) {
- $link="/$new";
+ $link=$new;
+ if ($linktext =~ m/\/*?[A-Z]/) {
+ # preserve leading cap
+ $link=ucfirst($link);
}
- else {
- $link=$new;
+ if (index($linktext, "/") == 0) {
+ # absolute link
+ $link="/$link";
}
}
defined $1