aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-08-13 02:03:43 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-08-13 02:03:43 +0000
commit4b36dee35a55b08d6d6f3bb3840220a4956f2540 (patch)
tree4202c4fa32c2ec537e065072e45b4bb9344b1147 /IkiWiki.pm
parent85ecbc6c4ea3af0b39034d985d4ca4adb243d94f (diff)
downloadikiwiki-4b36dee35a55b08d6d6f3bb3840220a4956f2540.tar
ikiwiki-4b36dee35a55b08d6d6f3bb3840220a4956f2540.tar.gz
* The last release accidentially installed ikiwiki as ikiwiki.pl, now fixed.
* Add --version. * Man page format fixups. * Add a %pagecase which maps lower-case page names to the actual case used in the filename. Use this in bestlinks calculation instead of forcing the link to lowercase. * Also use %pagecase in various other places that want to check if a page with a given name exists. * This means that links to pages with mixed case names will now work, even if the link is in some other case mixture, and mixed case pages should be fully supported throughout ikiwiki. * Recommend rebuilding wikis on upgrade to this version.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index 69452792c..560647e06 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -12,7 +12,7 @@ use Memoize;
memoize("abs2rel");
memoize("pagespec_translate");
-use vars qw{%config %links %oldlinks %oldpagemtime %pagectime
+use vars qw{%config %links %oldlinks %oldpagemtime %pagectime %pagecase
%renderedfiles %pagesources %depends %hooks %forcerebuild};
sub defaultconfig () { #{{{
@@ -238,7 +238,7 @@ sub bestlink ($$) { #{{{
# goes down the directory tree to the base looking for matching
# pages.
my $page=shift;
- my $link=lc(shift);
+ my $link=shift;
my $cwd=$page;
do {
@@ -247,9 +247,11 @@ sub bestlink ($$) { #{{{
$l.=$link;
if (exists $links{$l}) {
- #debug("for $page, \"$link\", use $l");
return $l;
}
+ elsif (exists $pagecase{lc $l}) {
+ return $pagecase{lc $l};
+ }
} while $cwd=~s!/?[^/]+$!!;
#print STDERR "warning: page $page, broken link: $link\n";
@@ -333,7 +335,7 @@ sub htmllink ($$$;$$$) { #{{{
}
if (! grep { $_ eq $bestlink } values %renderedfiles) {
return "<span><a href=\"".
- cgiurl(do => "create", page => $link, from => $page).
+ cgiurl(do => "create", page => lc($link), from => $page).
"\">?</a>$linktext</span>"
}
@@ -395,6 +397,7 @@ sub loadindex () { #{{{
$links{$page}=[@{$items{link}}];
$depends{$page}=$items{depends}[0] if exists $items{depends};
$renderedfiles{$page}=$items{dest}[0];
+ $pagecase{lc $page}=$page;
}
$pagectime{$page}=$items{ctime}[0];
}
@@ -588,7 +591,7 @@ sub match_glob ($$) { #{{{
sub match_link ($$) { #{{{
my $page=shift;
- my $link=shift;
+ my $link=lc(shift);
my $links = $links{$page} or return undef;
foreach my $p (@$links) {