summaryrefslogtreecommitdiff
path: root/IkiWiki.pm
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-21 20:11:18 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-12-21 20:11:18 +0000
commitff6941cef9a88ea2a0d3af2e5ae1edd09048916b (patch)
tree020be0085f59958e7bd9a4cb299da3dc3559ba78 /IkiWiki.pm
parent2335443eb6f8c7934984064d92805b4c5ccc8975 (diff)
* Add support for links of the form [../foo]], this links to the page
foo a level higher in the directory hierarchy than the one it would link to by default.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r--IkiWiki.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm
index f76e9fe30..499d3a71f 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -298,6 +298,12 @@ sub bestlink ($$) { #{{{
my $link=shift;
my $cwd=$page;
+
+ # relative links
+ while ($link=~s!(^|/)\.\./!!g) {
+ $cwd=~s!/?[^/]+$!!;
+ }
+
do {
my $l=$cwd;
$l.="/" if length $l;