baseurl => baseurl(),
@_,
);
+ run_hooks(pagetemplate => sub {
+ shift->(page => "", destpage => "", template => $template);
+ });
return $template->output;
}#}}}
changelog => $changelog,
baseurl => baseurl(),
);
+ run_hooks(pagetemplate => sub {
+ shift->(page => "", destpage => "", template => $template);
+ });
print $q->header(-charset => 'utf-8'), $template->output;
} #}}}
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',
params => $q,
action => $config{cgiurl},
table => 0,
- template => {template_params("editpage.tmpl")},
+ template => $renderer,
);
- my @buttons=("Save Page", "Preview", "Cancel");
decode_form_utf8($form);
--- /dev/null
+#!/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
* Patch from Recai to fix a wide character warning from the search plugin
during setup if the wikiname contains utf8.
* Yet another fix for those poor case-insensative OSX users.
+ * 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).
- -- Joey Hess <joeyh@debian.org> Fri, 15 Sep 2006 13:19:54 -0400
+ -- Joey Hess <joeyh@debian.org> Fri, 15 Sep 2006 19:39:36 -0400
ikiwiki (1.26) unstable; urgency=low
--- /dev/null
+[[template id=plugin name=favicon included=1 author="Joey Hess"]]
+[[tag type/chrome]]
+
+If this plugin is enabled, then an icon link is added to pages, for web
+browsers to display. The icon is currently hardcoded to be a favicon.png,
+which must be in the root of the wiki.
hook(type => "pagetemplate", id => "foo", call => \&pagetemplate);
-Each time a page (or part of a blog page, or an rss feed) is rendered, a
-[[template|templates]] is filled out. This hook allows modifying that
-template. The function is passed named parameters. The "page" and
-"destpage" parameters are the same as for a preprocess hook. The "template"
-parameter is a `HTML::Template` object that is the template that will be
-used to generate the page. The function can manipulate that template
-object.
+[[Templates]] are filled out for many different things in ikiwiki,
+like generating a page, or part of a blog page, or an rss feed, or a cgi.
+This hook allows modifying those templates. The function is passed named
+parameters. The "page" and "destpage" parameters are the same as for a
+preprocess hook. The "template" parameter is a `HTML::Template` object that
+is the template that will be used to generate the page. The function can
+manipulate that template object.
The most common thing to do is probably to call $template->param() to add
a new custom parameter to the template.
<title><TMPL_VAR FORM-TITLE></title>
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
+<TMPL_IF NAME="FAVICON">
+<link rel="icon" href="<TMPL_VAR BASEURL><TMPL_VAR FAVICON>" type="image/png" />
+</TMPL_IF>
</head>
<body>
<TMPL_IF NAME="PAGE_CONFLICT">
<title><TMPL_VAR TITLE></title>
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
+<TMPL_IF NAME="FAVICON">
+<link rel="icon" href="<TMPL_VAR BASEURL><TMPL_VAR FAVICON>" type="image/png" />
+</TMPL_IF>
</head>
<body>
<title><TMPL_VAR TITLE></title>
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
-<TMPL_IF NAME="RSSLINK">
-<TMPL_VAR RSSLINK>
-</TMPL_IF>
-<TMPL_IF NAME="META">
-<TMPL_VAR META>
+<TMPL_IF NAME="FAVICON">
+<link rel="icon" href="<TMPL_VAR BASEURL><TMPL_VAR FAVICON>" type="image/png" />
</TMPL_IF>
+<TMPL_IF NAME="RSSLINK"><TMPL_VAR RSSLINK></TMPL_IF>
+<TMPL_IF NAME="META"><TMPL_VAR META></TMPL_IF>
</head>
<body>
<title><TMPL_VAR TITLE></title>
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
+<TMPL_IF NAME="FAVICON">
+<link rel="icon" href="<TMPL_VAR BASEURL><TMPL_VAR FAVICON>" type="image/png" />
+</TMPL_IF>
</head>
<body>