From 5466a1daf99e8e4c67a19f871aaf558312569652 Mon Sep 17 00:00:00 2001 From: joey Date: Fri, 26 May 2006 01:10:58 +0000 Subject: * The page name and parent links has switched from using a

to a styled , so pages can use

internally instead of needing to use

. * Updated all of ikiwiki's own wiki pages for that. * Add pagetemplate hook, which can be used by plugins that want to mess around with adding new stuff to the page template. * Remove headercontent; the search plugin now adds the search box to the header by registering a pagetemplate hook, and other plugins should do similarly. --- IkiWiki/Plugin/search.pm | 12 ++++++++++-- IkiWiki/Plugin/skeleton.pm | 9 +++++++++ IkiWiki/Render.pm | 7 ++++++- IkiWiki/Wrapper.pm | 4 ---- 4 files changed, 25 insertions(+), 7 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index 213ed45ff..c94974ac4 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -9,6 +9,8 @@ use IkiWiki; sub import { #{{{ IkiWiki::hook(type => "checkconfig", id => "hyperestraier", call => \&checkconfig); + IkiWiki::hook(type => "pagetemplate", id => "hyperestraier", + call => \&pagetemplate); IkiWiki::hook(type => "delete", id => "hyperestraier", call => \&delete); IkiWiki::hook(type => "change", id => "hyperestraier", @@ -23,8 +25,14 @@ sub checkconfig () { #{{{ IkiWiki::error("Must specify $required when using the search plugin\n"); } } +} #}}} + +sub pagetemplate ($$) { #{{{ + my $page=shift; + my $template=shift; - $IkiWiki::config{headercontent}.=qq{ + # Add search box to page header. + $template->param(searchform => qq{
@@ -32,7 +40,7 @@ sub checkconfig () { #{{{
-}; +}); } #}}} sub delete (@) { #{{{ diff --git a/IkiWiki/Plugin/skeleton.pm b/IkiWiki/Plugin/skeleton.pm index 346dfa5ff..226270c38 100644 --- a/IkiWiki/Plugin/skeleton.pm +++ b/IkiWiki/Plugin/skeleton.pm @@ -17,6 +17,8 @@ sub import { #{{{ call => \&filter); IkiWiki::hook(type => "sanitize", id => "skeleton", call => \&sanitize); + IkiWiki::hook(type => "pagetemplate", id => "skeleton", + call => \&pagetemplate); IkiWiki::hook(type => "delete", id => "skeleton", call => \&delete); IkiWiki::hook(type => "change", id => "skeleton", @@ -51,6 +53,13 @@ sub sanitize ($) { #{{{ return $content; } # }}} +sub pagetemplate ($$) { #{{{ + my $page=shift; + my $template=shift; + + IkiWiki::debug("skeleton plugin running as a pagetemplate hook"); +} # }}} + sub delete (@) { #{{{ my @files=@_; diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 854d5105e..b59a721c0 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -177,7 +177,12 @@ sub genpage ($$$) { #{{{ if ($config{discussion}) { $template->param(discussionlink => htmllink($page, "Discussion", 1, 1)); } - $template->param(headercontent => $config{headercontent}); + + if (exists $hooks{pagetemplate}) { + foreach my $id (keys %{$hooks{pagetemplate}}) { + $hooks{pagetemplate}{$id}{call}->($page, $template); + } + } $template->param( title => $title, diff --git a/IkiWiki/Wrapper.pm b/IkiWiki/Wrapper.pm index 7d27abd06..52a7ca2c7 100644 --- a/IkiWiki/Wrapper.pm +++ b/IkiWiki/Wrapper.pm @@ -47,10 +47,6 @@ EOF EOF } - # This is only set by plugins, which append to it on startup, so - # avoid storing it in the wrapper. - $config{headercontent}=""; - $Data::Dumper::Indent=0; # no newlines my $configstring=Data::Dumper->Dump([\%config], ['*config']); $configstring=~s/\\/\\\\/g; -- cgit v1.2.3