summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-09-16 00:52:26 +0000
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>2006-09-16 00:52:26 +0000
commit0f25ec8eb640a850a8f1efe7081c03d05d04eda4 (patch)
tree5c290f48fb651b7c8c24849208328ef634ec22e9 /IkiWiki
parent6206e9a62e06ca9bf55f6bc659e7229ba0b911d1 (diff)
* pagetemplate hooks are now also called when generating cgi pages.
* Add a favicon plugin, which simply adds a link tag for an icon to each page (and cgis).
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/CGI.pm20
-rw-r--r--IkiWiki/Plugin/favicon.pm24
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