* 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).master
parent
6206e9a62e
commit
0f25ec8eb6
|
@ -604,6 +604,9 @@ sub misctemplate ($$;@) { #{{{
|
||||||
baseurl => baseurl(),
|
baseurl => baseurl(),
|
||||||
@_,
|
@_,
|
||||||
);
|
);
|
||||||
|
run_hooks(pagetemplate => sub {
|
||||||
|
shift->(page => "", destpage => "", template => $template);
|
||||||
|
});
|
||||||
return $template->output;
|
return $template->output;
|
||||||
}#}}}
|
}#}}}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,9 @@ sub cgi_recentchanges ($) { #{{{
|
||||||
changelog => $changelog,
|
changelog => $changelog,
|
||||||
baseurl => baseurl(),
|
baseurl => baseurl(),
|
||||||
);
|
);
|
||||||
|
run_hooks(pagetemplate => sub {
|
||||||
|
shift->(page => "", destpage => "", template => $template);
|
||||||
|
});
|
||||||
print $q->header(-charset => 'utf-8'), $template->output;
|
print $q->header(-charset => 'utf-8'), $template->output;
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
@ -349,9 +352,19 @@ sub cgi_editpage ($$) { #{{{
|
||||||
my $q=shift;
|
my $q=shift;
|
||||||
my $session=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(
|
my $form = CGI::FormBuilder->new(
|
||||||
fields => [qw(do rcsinfo subpage from page type editcontent comments)],
|
fields => \@fields,
|
||||||
header => 1,
|
header => 1,
|
||||||
charset => "utf-8",
|
charset => "utf-8",
|
||||||
method => 'POST',
|
method => 'POST',
|
||||||
|
@ -363,9 +376,8 @@ sub cgi_editpage ($$) { #{{{
|
||||||
params => $q,
|
params => $q,
|
||||||
action => $config{cgiurl},
|
action => $config{cgiurl},
|
||||||
table => 0,
|
table => 0,
|
||||||
template => {template_params("editpage.tmpl")},
|
template => $renderer,
|
||||||
);
|
);
|
||||||
my @buttons=("Save Page", "Preview", "Cancel");
|
|
||||||
|
|
||||||
decode_form_utf8($form);
|
decode_form_utf8($form);
|
||||||
|
|
||||||
|
|
|
@ -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
|
|
@ -33,8 +33,11 @@ ikiwiki (1.27) UNRELEASED; urgency=low
|
||||||
* Patch from Recai to fix a wide character warning from the search plugin
|
* Patch from Recai to fix a wide character warning from the search plugin
|
||||||
during setup if the wikiname contains utf8.
|
during setup if the wikiname contains utf8.
|
||||||
* Yet another fix for those poor case-insensative OSX users.
|
* 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
|
ikiwiki (1.26) unstable; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
[[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.
|
|
@ -105,13 +105,13 @@ return the htmlized content.
|
||||||
|
|
||||||
hook(type => "pagetemplate", id => "foo", call => \&pagetemplate);
|
hook(type => "pagetemplate", id => "foo", call => \&pagetemplate);
|
||||||
|
|
||||||
Each time a page (or part of a blog page, or an rss feed) is rendered, a
|
[[Templates]] are filled out for many different things in ikiwiki,
|
||||||
[[template|templates]] is filled out. This hook allows modifying that
|
like generating a page, or part of a blog page, or an rss feed, or a cgi.
|
||||||
template. The function is passed named parameters. The "page" and
|
This hook allows modifying those templates. The function is passed named
|
||||||
"destpage" parameters are the same as for a preprocess hook. The "template"
|
parameters. The "page" and "destpage" parameters are the same as for a
|
||||||
parameter is a `HTML::Template` object that is the template that will be
|
preprocess hook. The "template" parameter is a `HTML::Template` object that
|
||||||
used to generate the page. The function can manipulate that template
|
is the template that will be used to generate the page. The function can
|
||||||
object.
|
manipulate that template object.
|
||||||
|
|
||||||
The most common thing to do is probably to call $template->param() to add
|
The most common thing to do is probably to call $template->param() to add
|
||||||
a new custom parameter to the template.
|
a new custom parameter to the template.
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
<title><TMPL_VAR FORM-TITLE></title>
|
<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>style.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<TMPL_IF NAME="PAGE_CONFLICT">
|
<TMPL_IF NAME="PAGE_CONFLICT">
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
<title><TMPL_VAR TITLE></title>
|
<title><TMPL_VAR TITLE></title>
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
|
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
|
@ -6,12 +6,11 @@
|
||||||
<title><TMPL_VAR TITLE></title>
|
<title><TMPL_VAR TITLE></title>
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
|
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
|
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.css" type="text/css" />
|
||||||
<TMPL_IF NAME="RSSLINK">
|
<TMPL_IF NAME="FAVICON">
|
||||||
<TMPL_VAR RSSLINK>
|
<link rel="icon" href="<TMPL_VAR BASEURL><TMPL_VAR FAVICON>" type="image/png" />
|
||||||
</TMPL_IF>
|
|
||||||
<TMPL_IF NAME="META">
|
|
||||||
<TMPL_VAR META>
|
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
|
<TMPL_IF NAME="RSSLINK"><TMPL_VAR RSSLINK></TMPL_IF>
|
||||||
|
<TMPL_IF NAME="META"><TMPL_VAR META></TMPL_IF>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,9 @@
|
||||||
<title><TMPL_VAR TITLE></title>
|
<title><TMPL_VAR TITLE></title>
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
|
<link rel="stylesheet" href="<TMPL_VAR BASEURL>style.css" type="text/css" />
|
||||||
<link rel="stylesheet" href="<TMPL_VAR BASEURL>local.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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue