From cf3021ef3f5cb839195585d601de76df519da510 Mon Sep 17 00:00:00 2001 From: joey Date: Mon, 21 Aug 2006 22:27:02 +0000 Subject: [PATCH] * Fixed a bug with previews of subpages having broken links to top-level pages. * Change how the stylesheet url is determined in the templates: Remove STYLEURL and add BASEURL to all templates (some already had it). This new more general variable can be used to link to other things (eg, images) from the template, as well as stylesheets. --- IkiWiki.pm | 9 ++++----- IkiWiki/CGI.pm | 12 +++++------- IkiWiki/Render.pm | 2 +- debian/changelog | 11 +++++++++++ doc/index/discussion.mdwn | 26 +++++++++----------------- templates/editpage.tmpl | 4 +--- templates/misc.tmpl | 4 +--- templates/page.tmpl | 2 +- templates/recentchanges.tmpl | 4 +--- 9 files changed, 34 insertions(+), 40 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index 4e3011918..9556d6ef7 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -304,14 +304,14 @@ sub cgiurl (@) { #{{{ return $config{cgiurl}."?".join("&", map "$_=$params{$_}", keys %params); } #}}} -sub styleurl (;$) { #{{{ +sub baseurl (;$) { #{{{ my $page=shift; - return "$config{url}/style.css" if ! defined $page; + return "$config{url}/" if ! defined $page; $page=~s/[^\/]+$//; $page=~s/[^\/]+\//..\//g; - return $page."style.css"; + return $page; } #}}} sub abs2rel ($$) { #{{{ @@ -476,8 +476,7 @@ sub misctemplate ($$) { #{{{ indexlink => indexlink(), wikiname => $config{wikiname}, pagebody => $pagebody, - styleurl => styleurl(), - baseurl => "$config{url}/", + baseurl => baseurl(), ); return $template->output; }#}}} diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 4c15be0ae..7d4ba146f 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -70,8 +70,7 @@ sub cgi_recentchanges ($) { #{{{ indexlink => indexlink(), wikiname => $config{wikiname}, changelog => [rcs_recentchanges(100)], - styleurl => styleurl(), - baseurl => "$config{url}/", + baseurl => baseurl(), ); print $q->header(-charset=>'utf-8'), $template->output; } #}}} @@ -100,7 +99,7 @@ sub cgi_signin ($$) { #{{{ header => 0, template => (-e "$config{templatedir}/signin.tmpl" ? {template_params("signin.tmpl")} : ""), - stylesheet => styleurl(), + stylesheet => baseurl()."style.css", ); decode_form_utf8($form); @@ -267,7 +266,7 @@ sub cgi_prefs ($$) { #{{{ action => $config{cgiurl}, template => (-e "$config{templatedir}/prefs.tmpl" ? {template_params("prefs.tmpl")} : ""), - stylesheet => styleurl(), + stylesheet => baseurl()."style.css", ); my @buttons=("Save Preferences", "Logout", "Cancel"); @@ -394,8 +393,7 @@ sub cgi_editpage ($$) { #{{{ $form->tmpl_param("indexlink", indexlink()); $form->tmpl_param("helponformattinglink", htmllink("", "", "HelpOnFormatting", 1)); - $form->tmpl_param("styleurl", styleurl()); - $form->tmpl_param("baseurl", "$config{url}/"); + $form->tmpl_param("baseurl", baseurl()); if (! $form->submitted) { $form->field(name => "rcsinfo", value => rcs_prepedit($file), force => 1); @@ -414,7 +412,7 @@ sub cgi_editpage ($$) { #{{{ $form->field(name => "comments", value => $comments, force => 1); $form->tmpl_param("page_preview", - htmlize($type, linkify($page, $page, filter($page, $content)))); + htmlize($type, linkify($page, "", filter($page, $content)))); } else { $form->tmpl_param("page_preview", ""); diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index b4b95e8d4..ddd146922 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -180,7 +180,7 @@ sub genpage ($$$) { #{{{ content => $content, backlinks => [backlinks($page)], mtime => displaytime($mtime), - styleurl => styleurl($page), + baseurl => baseurl($page), ); run_hooks(pagetemplate => sub { diff --git a/debian/changelog b/debian/changelog index 3d6d50cb1..323dcf6b2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,14 @@ +ikiwiki (1.22) UNRELEASED; urgency=low + + * Fixed a bug with previews of subpages having broken links to top-level + pages. + * Change how the stylesheet url is determined in the templates: Remove + STYLEURL and add BASEURL to all templates (some already had it). This + new more general variable can be used to link to other things (eg, images) + from the template, as well as stylesheets. + + -- Joey Hess Mon, 21 Aug 2006 18:16:09 -0400 + ikiwiki (1.21) unstable; urgency=low * Add a tail fin^W^Wsidebar plugin by Tuomo Valkonen. diff --git a/doc/index/discussion.mdwn b/doc/index/discussion.mdwn index c8b082a82..b4f38ee51 100644 --- a/doc/index/discussion.mdwn +++ b/doc/index/discussion.mdwn @@ -1,20 +1,12 @@ -Seems like there should be a page for you to post your thoughts about ikiwiki, both pro and con, anything that didn't work, ideas, or whatever. Do so here.. +Seems like there should be a page for you to post your thoughts about +ikiwiki, both pro and con, anything that didn't work, ideas, or whatever. +Do so here.. -Note that for more formal bug reports or todo items, you can also edit the [[bugs]] and [[todo]] pages. +Note that for more formal bug reports or todo items, you can also edit the +[[bugs]] and [[todo]] pages. ----- -How about adding ACL? So that you can control which users are allowed to read, write certain pages. The moinmoin wiki has that, and it is something, that I think is very valuable. - ----- -It would be interesting to have a `` that would act exactly like the current `STYLEURL`, but without adding 'style.css' (`STYLEURL` could be defined in terms of `BASEURL`). This way it would be possible to have more flexible templates allowing multiple stylesheets, shortcut icons (and other images), etc. - - sub baseurl (;$) { #{{{ - my $page=shift; - - return "$config{url}/" if ! defined $page; - - $page=~s/[^\/]+$//; - $page=~s/[^\/]+\//..\//g; - return $page; - } #}}} +---- +How about adding ACL? So that you can control which users are allowed +to read, write certain pages. The moinmoin wiki has that, and it is +something, that I think is very valuable. diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl index 1ee4c4947..27155f5cf 100644 --- a/templates/editpage.tmpl +++ b/templates/editpage.tmpl @@ -2,12 +2,10 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - <TMPL_VAR FORM-TITLE> - + diff --git a/templates/misc.tmpl b/templates/misc.tmpl index d50fba423..0376a19f9 100644 --- a/templates/misc.tmpl +++ b/templates/misc.tmpl @@ -2,12 +2,10 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - <TMPL_VAR TITLE> - + diff --git a/templates/page.tmpl b/templates/page.tmpl index 47bbfcda3..438fbc25d 100644 --- a/templates/page.tmpl +++ b/templates/page.tmpl @@ -4,7 +4,7 @@ <TMPL_VAR TITLE> - + diff --git a/templates/recentchanges.tmpl b/templates/recentchanges.tmpl index 250e5de51..792fff00c 100644 --- a/templates/recentchanges.tmpl +++ b/templates/recentchanges.tmpl @@ -2,12 +2,10 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - - <TMPL_VAR TITLE> - + -- 2.44.0