From f62d23f008367d403f6f75a1673c673b2137f49b Mon Sep 17 00:00:00 2001
From: joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Date: Fri, 29 Dec 2006 05:33:20 +0000
Subject: [PATCH 1/1] * If a userdir is configured, links to pages in it can be
 made without   specifying the path. This allows for easy signing of comments
 by linking   to your page in the userdir.

---
 IkiWiki.pm                           | 4 ++++
 IkiWiki/CGI.pm                       | 2 ++
 basewiki/subpage/linkingrules.mdwn   | 5 +++++
 debian/changelog                     | 5 ++++-
 doc/todo/userdir_links.mdwn          | 2 ++
 doc/users.mdwn                       | 5 +++++
 doc/{index => users}/chris.mdwn      | 0
 doc/{ => users}/jeremyreed.mdwn      | 0
 doc/{ => users}/joey.mdwn            | 0
 doc/{ => users}/jonassmedegaard.mdwn | 0
 10 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 doc/users.mdwn
 rename doc/{index => users}/chris.mdwn (100%)
 rename doc/{ => users}/jeremyreed.mdwn (100%)
 rename doc/{ => users}/joey.mdwn (100%)
 rename doc/{ => users}/jonassmedegaard.mdwn (100%)

diff --git a/IkiWiki.pm b/IkiWiki.pm
index 2ee27ac3e..960d4da99 100644
--- a/IkiWiki.pm
+++ b/IkiWiki.pm
@@ -319,6 +319,10 @@ sub bestlink ($$) { #{{{
 		}
 	} while $cwd=~s!/?[^/]+$!!;
 
+	if (length $config{userdir} && exists $links{"$config{userdir}/".lc($link)}) {
+		return $links{"$config{userdir}/".lc($link)};
+	}
+
 	#print STDERR "warning: page $page, broken link: $link\n";
 	return "";
 } #}}}
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm
index 511358ff5..7f84f345a 100644
--- a/IkiWiki/CGI.pm
+++ b/IkiWiki/CGI.pm
@@ -419,6 +419,8 @@ sub cgi_editpage ($$) { #{{{
 					push @page_locs, $dir.$page;
 				}
 			}
+			push @page_locs, "$config{userdir}/$page"
+				if length $config{userdir};
 
 			@page_locs = grep {
 				! exists $pagecase{lc $_} &&
diff --git a/basewiki/subpage/linkingrules.mdwn b/basewiki/subpage/linkingrules.mdwn
index c07a81387..c1062304a 100644
--- a/basewiki/subpage/linkingrules.mdwn
+++ b/basewiki/subpage/linkingrules.mdwn
@@ -25,3 +25,8 @@ 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".
+
+Also, if the wiki is configured with a userdir, you can link to pages
+within the userdir without specifying a path to them. This is to allow for
+easy linking to a user's page in the userdir, to sign a comment. These
+links are checked for last of all.
diff --git a/debian/changelog b/debian/changelog
index 9d6b7a42a..0735c2db7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -20,8 +20,11 @@ ikiwiki (1.37) UNRELEASED; urgency=low
   * Don't put discussion links on discussion pages.
   * Allow disabling of plugins included in goodstuff.
   * Add a textile format plugin contributed by mazirian.
+  * If a userdir is configured, links to pages in it can be made without
+    specifying the path. This allows for easy signing of comments by linking
+    to your page in the userdir.
 
- -- Joey Hess <joeyh@debian.org>  Fri, 29 Dec 2006 00:17:58 -0500
+ -- Joey Hess <joeyh@debian.org>  Fri, 29 Dec 2006 00:26:47 -0500
 
 ikiwiki (1.36) unstable; urgency=low
 
diff --git a/doc/todo/userdir_links.mdwn b/doc/todo/userdir_links.mdwn
index 02ebea6d6..02dbdaa65 100644
--- a/doc/todo/userdir_links.mdwn
+++ b/doc/todo/userdir_links.mdwn
@@ -1,3 +1,5 @@
 The userdir should be searched at the end of the search "path" for links,
 so that users can put their pages in the userdir, and still link to them
 easily when signing things, without giving a path.
+
+[[todo/done]]
diff --git a/doc/users.mdwn b/doc/users.mdwn
new file mode 100644
index 000000000..3b8434a4c
--- /dev/null
+++ b/doc/users.mdwn
@@ -0,0 +1,5 @@
+See [[IkiwikiUsers]] for the list of sites using ikiwiki.
+
+Users of this wiki, feel free to create a subpage of this one and talk
+about yourself on it, within reason. You can link to it to sign your
+comments.
diff --git a/doc/index/chris.mdwn b/doc/users/chris.mdwn
similarity index 100%
rename from doc/index/chris.mdwn
rename to doc/users/chris.mdwn
diff --git a/doc/jeremyreed.mdwn b/doc/users/jeremyreed.mdwn
similarity index 100%
rename from doc/jeremyreed.mdwn
rename to doc/users/jeremyreed.mdwn
diff --git a/doc/joey.mdwn b/doc/users/joey.mdwn
similarity index 100%
rename from doc/joey.mdwn
rename to doc/users/joey.mdwn
diff --git a/doc/jonassmedegaard.mdwn b/doc/users/jonassmedegaard.mdwn
similarity index 100%
rename from doc/jonassmedegaard.mdwn
rename to doc/users/jonassmedegaard.mdwn
-- 
2.39.5