aboutsummaryrefslogtreecommitdiff
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
parent2335443eb6f8c7934984064d92805b4c5ccc8975 (diff)
downloadikiwiki-ff6941cef9a88ea2a0d3af2e5ae1edd09048916b.tar
ikiwiki-ff6941cef9a88ea2a0d3af2e5ae1edd09048916b.tar.gz
* 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.
-rw-r--r--IkiWiki.pm6
-rw-r--r--basewiki/subpage/linkingrules.mdwn6
-rw-r--r--debian/changelog5
-rw-r--r--doc/bugs/linkingrules_should_document_how_to_link_to_page_at_root_if_non-root_page_exists.mdwn4
-rw-r--r--doc/todo/latex.mdwn6
5 files changed, 22 insertions, 5 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;
diff --git a/basewiki/subpage/linkingrules.mdwn b/basewiki/subpage/linkingrules.mdwn
index 83625ccbd..1543801b3 100644
--- a/basewiki/subpage/linkingrules.mdwn
+++ b/basewiki/subpage/linkingrules.mdwn
@@ -19,3 +19,9 @@ the only way to link to an unrelated [[SubPage]].
You can use this to, for example, to link from BazBar to "FooBar/SubPage",
or from BazBar/SubPage to "FooBar/SubPage".
+
+You can also use ".." in a link, to specify exactly which page to link to,
+when there are multiple pages with similar names and the link goes to the
+wrong page by default. For example, linking from "FooBar/SubPage" to
+".../OtherPage" will link to the "OtherPage" in the root of the wiki, even
+if there is a "FooBar/OtherPage".
diff --git a/debian/changelog b/debian/changelog
index 80edfc972..b783cd1d9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -18,8 +18,11 @@ ikiwiki (1.36) UNRELEASED; urgency=low
like, if you want.
* Patch from Emanuele Aina to fix modification time code in mercurual
backend.
+ * 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.
- -- Joey Hess <joeyh@debian.org> Thu, 21 Dec 2006 14:39:26 -0500
+ -- Joey Hess <joeyh@debian.org> Thu, 21 Dec 2006 15:10:03 -0500
ikiwiki (1.35) unstable; urgency=low
diff --git a/doc/bugs/linkingrules_should_document_how_to_link_to_page_at_root_if_non-root_page_exists.mdwn b/doc/bugs/linkingrules_should_document_how_to_link_to_page_at_root_if_non-root_page_exists.mdwn
index a4578f719..862feb0cb 100644
--- a/doc/bugs/linkingrules_should_document_how_to_link_to_page_at_root_if_non-root_page_exists.mdwn
+++ b/doc/bugs/linkingrules_should_document_how_to_link_to_page_at_root_if_non-root_page_exists.mdwn
@@ -1,5 +1,3 @@
The [[linking_rules|subpage/linkingrules]] should document how to link to a page at the root of the wiki when a normal, unadorned link would use a page of the same name further down the hierarchy. For example, how should [[todo/latex]] link to [[logo]] rather than [[todo/logo|todo/logo]]?
-> I agree, unfortunatly the real bug is that the linking rules don't
-> provide a way to do such a link. \\[[../foo]] is probably the best
-> approach, although it won't work yet. --[[Joey]]
+> [[bugs/done]].. the syntax to use is \\[[../logo]] --[[Joey]]
diff --git a/doc/todo/latex.mdwn b/doc/todo/latex.mdwn
index 71a291974..3255514a4 100644
--- a/doc/todo/latex.mdwn
+++ b/doc/todo/latex.mdwn
@@ -1 +1,5 @@
-How about a plugin adding a [[preprocessor_directive|preprocessordirective]] to render some given LaTeX as a PNG via [[debpkg dvipng]] and include the resulting image in the page? Useful for mathematics, as well as for stuff like the LaTeX version of the ikiwiki [[logo]]. \ No newline at end of file
+How about a plugin adding a
+[[preprocessor_directive|preprocessordirective]] to render some given LaTeX
+as a PNG via [[debpkg dvipng]] and include the resulting image in the page?
+Useful for mathematics, as well as for stuff like the LaTeX version of the
+ikiwiki [[../logo]].