From 8be2b60aaca495b84c299cf69ee8958603bd7204 Mon Sep 17 00:00:00 2001
From: Joey Hess <joey@kodama.kitenet.net>
Date: Thu, 14 Feb 2008 15:20:49 -0500
Subject: * The search plugin needs to override <base> to point to the
 directory   containing ikiwiki.cgi, but this should not change the urls to
 the style   sheets etc. Add a new forcebareurl parameter to misctemplate to
 allow   it to do that.

---
 IkiWiki/Plugin/search.pm                        | 2 +-
 debian/changelog                                | 4 ++++
 doc/bugs/search_plugin_uses_wrong_css_path.mdwn | 3 +++
 templates/misc.tmpl                             | 4 ++++
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm
index da818e5cf..9bf223cf0 100644
--- a/IkiWiki/Plugin/search.pm
+++ b/IkiWiki/Plugin/search.pm
@@ -96,7 +96,7 @@ sub estcfg () { #{{{
 	open(TEMPLATE, ">:utf8", $newfile) || error("open $newfile: $!", $cleanup);
 	print TEMPLATE IkiWiki::misctemplate("search", 
 		"<!--ESTFORM-->\n\n<!--ESTRESULT-->\n\n<!--ESTINFO-->\n\n",
-		baseurl => IkiWiki::dirname($config{cgiurl})."/") ||
+		forcebaseurl => IkiWiki::dirname($config{cgiurl})."/") ||
 			error("write $newfile: $!", $cleanup);
 	close TEMPLATE || error("save $newfile: $!", $cleanup);
 	rename($newfile, "$estdir/$cgi.tmpl") ||
diff --git a/debian/changelog b/debian/changelog
index 70935c1d7..d56c132ad 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -23,6 +23,10 @@ ikiwiki (2.40) UNRELEASED; urgency=low
   * Setting NOTAINT=1 had no effect when building ikiwiki itself, fix this.
   * Depend on HTML::Scrubber, since the scrubber is enabled by default and
     dies if its can't be loaded.
+  * The search plugin needs to override <base> to point to the directory
+    containing ikiwiki.cgi, but this should not change the urls to the style
+    sheets etc. Add a new forcebareurl parameter to misctemplate to allow
+    it to do that.
 
  -- Josh Triplett <josh@freedesktop.org>  Sun, 10 Feb 2008 13:18:58 -0800
 
diff --git a/doc/bugs/search_plugin_uses_wrong_css_path.mdwn b/doc/bugs/search_plugin_uses_wrong_css_path.mdwn
index fc3f8a6e4..9eeb3c374 100644
--- a/doc/bugs/search_plugin_uses_wrong_css_path.mdwn
+++ b/doc/bugs/search_plugin_uses_wrong_css_path.mdwn
@@ -9,3 +9,6 @@ Maybe misctemplate() and misc.tmpl should use an additional
 variable which points always to the base of the wiki.
 
 e.g. use "wikibase" for css and favicon and "baseurl" for the &lt;base&gt; tag.
+
+> thanks for pointing this bug out, I've fixed it --[[Joey]].
+[[tag done]]
diff --git a/templates/misc.tmpl b/templates/misc.tmpl
index 184920eaf..7f65217d1 100644
--- a/templates/misc.tmpl
+++ b/templates/misc.tmpl
@@ -2,7 +2,11 @@
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
+<TMPL_IF NAME="FORCEBASEURL">
+<base href="<TMPL_VAR FORCEBASEURL>" />
+<TMPL_ELSE>
 <base href="<TMPL_VAR BASEURL>" />
+</TMPL_IF>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title><TMPL_VAR TITLE></title>
 <link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
-- 
cgit v1.2.3