use cgitemplate, remove misctemplate

master
Joey Hess 2011-01-05 17:15:38 -04:00
parent 4a6ac6b485
commit d991ccf134
9 changed files with 23 additions and 52 deletions

View File

@ -1916,39 +1916,6 @@ sub template ($;@) {
template_depends(shift, undef, @_);
}
sub misctemplate ($$;@) {
my $title=shift;
my $content=shift;
my %params=@_;
my $template=template("page.tmpl");
my $page="";
if (exists $params{page}) {
$page=delete $params{page};
}
run_hooks(pagetemplate => sub {
shift->(
page => $page,
destpage => $page,
template => $template,
);
});
templateactions($template, "");
$template->param(
dynamic => 1,
title => $title,
wikiname => $config{wikiname},
content => $content,
baseurl => $config{url}.'/',
html5 => $config{html5},
%params,
);
return $template->output;
}
sub templateactions ($$) {
my $template=shift;
my $page=shift;

View File

@ -504,7 +504,7 @@ sub editcomment ($$) {
IkiWiki::saveindex();
IkiWiki::printheader($session);
print IkiWiki::misctemplate(gettext(gettext("comment stored for moderation")),
print IkiWiki::cgitemplate($cgi, gettext(gettext("comment stored for moderation")),
"<p>".
gettext("Your comment will be posted after moderator review").
"</p>");
@ -660,7 +660,7 @@ sub commentmoderation ($$) {
IkiWiki::run_hooks(format => sub {
$out = shift->(page => "", content => $out);
});
print IkiWiki::misctemplate(gettext("comment moderation"), $out);
print IkiWiki::cgitemplate($cgi, gettext("comment moderation"), $out);
exit;
}

View File

@ -61,7 +61,7 @@ sub cgi_getsource ($) {
IkiWiki::cgi_custom_failure(
$cgi,
"404 Not Found",
IkiWiki::misctemplate(gettext("missing page"),
IkiWiki::cgitemplate($cgi, gettext("missing page"),
"<p>".
sprintf(gettext("The page %s does not exist."),
htmllink("", "", $page)).
@ -72,7 +72,7 @@ sub cgi_getsource ($) {
if (! defined pagetype($pagesources{$page})) {
IkiWiki::cgi_custom_failure(
$cgi->header(-status => "403 Forbidden"),
IkiWiki::misctemplate(gettext("not a page"),
IkiWiki::cgitemplate($cgi, gettext("not a page"),
"<p>".
sprintf(gettext("%s is an attachment, not a page."),
htmllink("", "", $page)).

View File

@ -56,7 +56,7 @@ sub cgi_goto ($;$) {
IkiWiki::cgi_custom_failure(
$q,
"404 Not Found",
IkiWiki::misctemplate(gettext("missing page"),
IkiWiki::cgitemplate($q, gettext("missing page"),
"<p>".
sprintf(gettext("The page %s does not exist."),
htmllink("", "", $page)).

View File

@ -84,7 +84,7 @@ sub openid_selector {
);
IkiWiki::printheader($session);
print IkiWiki::misctemplate("signin", $template->output);
print IkiWiki::cgitemplate($q, "signin", $template->output);
exit;
}

View File

@ -227,20 +227,21 @@ sub setupfiles () {
"database_dir .\n".
"template_dir ./templates\n");
# Avoid omega interpreting anything in the misctemplate
# Avoid omega interpreting anything in the cgitemplate
# as an omegascript command.
my $misctemplate=IkiWiki::misctemplate(gettext("search"), "\0",
eval q{use IkiWiki::CGI};
my $template=IkiWiki::cgitemplate(undef, gettext("search"), "\0",
searchform => "", # avoid showing the small search form
);
eval q{use HTML::Entities};
error $@ if $@;
$misctemplate=encode_entities($misctemplate, '\$');
$template=encode_entities($template, '\$');
my $querytemplate=readfile(IkiWiki::template_file("searchquery.tmpl"));
$misctemplate=~s/\0/$querytemplate/;
$template=~s/\0/$querytemplate/;
writefile("query", $config{wikistatedir}."/xapian/templates",
$misctemplate);
$template);
$setup=1;
}
}

View File

@ -447,10 +447,10 @@ sub showform ($$) {
IkiWiki::saveindex();
IkiWiki::unlockwiki();
# Print the top part of a standard misctemplate,
# Print the top part of a standard cgitemplate,
# then show the rebuild or refresh, live.
my $divider="\0";
my $html=IkiWiki::misctemplate("setup", $divider);
my $html=IkiWiki::cgitemplate($cgi, "setup", $divider);
IkiWiki::printheader($session);
my ($head, $tail)=split($divider, $html, 2);
print $head."<pre>\n";

11
debian/changelog vendored
View File

@ -3,15 +3,16 @@ ikiwiki (3.20101232) UNRELEASED; urgency=low
* tag: Do not include tagbase in rss/atom category tags. (Giuseppe Bilotta)
* tag: Improve display of tags with a slash in their names.
(Giuseppe Bilotta)
* Fix base url when previewing. Was broken by base changes in last release.
* Fix redirect to use a full url. Was broken (in theory) by baseurl
changes in last release.
* Temporarily revert one part of the multiple url support in the last
release. Non-edit pages are now back to having `<base>` set to
the site's main url.
* Fix `<base>` output by cgi to have a full url again, broken by last
release.
* Fix permalinks to recentchanges items and comments, broken by last
release.
* Export three cgi env vars needed for CGI->url to work.
* Export three cgi env vars needed for CGI->url to work. Fixed
openid breakage from last release.
* Removed `IkiWiki::misctemplate()` function. Any plugins using
it should use `IkiWiki::cgitemplate()` instead.
-- Joey Hess <joeyh@debian.org> Tue, 04 Jan 2011 16:00:55 -0400

View File

@ -1,6 +1,6 @@
## current status
99% of the way there, but:
[[done]] again! :)
* CGI pages, with the exception of edit pages, set `<base>` to
`$config{url}`
@ -15,6 +15,8 @@
generate a better baseurl. Not sure yet what to do; may have to thread
a cgi parameter through all the calls to misctemplate. --[[Joey]]
> Fixed, cgitemplate is used now. --[[Joey]]
* Using `do=goto` to go to a comment or recentchanges item
will redirect to the `$config{url}`-based url, since the
permalinks are made to be absolute urls now.