diff options
Diffstat (limited to 'IkiWiki')
-rw-r--r-- | IkiWiki/CGI.pm | 20 | ||||
-rw-r--r-- | IkiWiki/Plugin/favicon.pm | 24 |
2 files changed, 40 insertions, 4 deletions
diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 01c5812ef..f07a4e5a2 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -99,6 +99,9 @@ sub cgi_recentchanges ($) { #{{{ changelog => $changelog, baseurl => baseurl(), ); + run_hooks(pagetemplate => sub { + shift->(page => "", destpage => "", template => $template); + }); print $q->header(-charset => 'utf-8'), $template->output; } #}}} @@ -349,9 +352,19 @@ sub cgi_editpage ($$) { #{{{ my $q=shift; my $session=shift; - eval q{use CGI::FormBuilder}; + my @fields=qw(do rcsinfo subpage from page type editcontent comments); + my @buttons=("Save Page", "Preview", "Cancel"); + + eval q{use CGI::FormBuilder; use CGI::FormBuilder::Template::HTML}; + my $renderer=CGI::FormBuilder::Template::HTML->new( + fields => \@fields, + template_params("editpage.tmpl"), + ); + run_hooks(pagetemplate => sub { + shift->(page => "", destpage => "", template => $renderer->engine); + }); my $form = CGI::FormBuilder->new( - fields => [qw(do rcsinfo subpage from page type editcontent comments)], + fields => \@fields, header => 1, charset => "utf-8", method => 'POST', @@ -363,9 +376,8 @@ sub cgi_editpage ($$) { #{{{ params => $q, action => $config{cgiurl}, table => 0, - template => {template_params("editpage.tmpl")}, + template => $renderer, ); - my @buttons=("Save Page", "Preview", "Cancel"); decode_form_utf8($form); diff --git a/IkiWiki/Plugin/favicon.pm b/IkiWiki/Plugin/favicon.pm new file mode 100644 index 000000000..518d2c2ff --- /dev/null +++ b/IkiWiki/Plugin/favicon.pm @@ -0,0 +1,24 @@ +#!/usr/bin/perl +# favicon plugin. + +package IkiWiki::Plugin::favicon; + +use warnings; +use strict; +use IkiWiki; + +sub import { #{{{ + hook(type => "pagetemplate", id => "favicon", call => \&pagetemplate); +} # }}} + +sub pagetemplate (@) { #{{{ + my %params=@_; + + my $template=$params{template}; + + if ($template->query(name => "favicon")) { + $template->param(favicon => "favicon.png"); + } +} # }}} + +1 |