change calling convention for preprocessor functions

master
joey 2006-05-01 23:18:09 +00:00
parent 258af4c179
commit 457d6bbbbf
1 changed files with 11 additions and 12 deletions

View File

@ -146,7 +146,7 @@ sub preprocess ($$) { #{{{
while ($params =~ /(\w+)=\"([^"]+)"(\s+|$)/g) { while ($params =~ /(\w+)=\"([^"]+)"(\s+|$)/g) {
$params{$1}=$2; $params{$1}=$2;
} }
return $commands{$command}->($page, %params); return $commands{$command}->(page => $page, %params);
} }
else { else {
return "[[bad directive $command]]"; return "[[bad directive $command]]";
@ -188,7 +188,6 @@ sub get_inline_content ($$) { #{{{
} #}}} } #}}}
sub preprocess_inline ($@) { #{{{ sub preprocess_inline ($@) { #{{{
my $parentpage=shift;
my %params=@_; my %params=@_;
if (! exists $params{pages}) { if (! exists $params{pages}) {
@ -200,11 +199,11 @@ sub preprocess_inline ($@) { #{{{
if (! exists $params{show} && $params{archive} eq "no") { if (! exists $params{show} && $params{archive} eq "no") {
$params{show}=10; $params{show}=10;
} }
if (! exists $depends{$parentpage}) { if (! exists $depends{$params{page}}) {
$depends{$parentpage}=$params{pages}; $depends{$params{page}}=$params{pages};
} }
else { else {
$depends{$parentpage}.=" ".$params{pages}; $depends{$params{page}}.=" ".$params{pages};
} }
my $ret=""; my $ret="";
@ -216,7 +215,7 @@ sub preprocess_inline ($@) { #{{{
$formtemplate->param(cgiurl => $config{cgiurl}); $formtemplate->param(cgiurl => $config{cgiurl});
$formtemplate->param(rootpage => $params{rootpage}); $formtemplate->param(rootpage => $params{rootpage});
if ($config{rss}) { if ($config{rss}) {
$formtemplate->param(rssurl => rsspage(basename($parentpage))); $formtemplate->param(rssurl => rsspage(basename($params{page})));
} }
$ret.=$formtemplate->output; $ret.=$formtemplate->output;
} }
@ -224,7 +223,7 @@ sub preprocess_inline ($@) { #{{{
# Add a rss link button. # Add a rss link button.
my $linktemplate=HTML::Template->new(blind_cache => 1, my $linktemplate=HTML::Template->new(blind_cache => 1,
filename => "$config{templatedir}/rsslink.tmpl"); filename => "$config{templatedir}/rsslink.tmpl");
$linktemplate->param(rssurl => rsspage(basename($parentpage))); $linktemplate->param(rssurl => rsspage(basename($params{page})));
$ret.=$linktemplate->output; $ret.=$linktemplate->output;
} }
@ -235,10 +234,10 @@ sub preprocess_inline ($@) { #{{{
my @pages; my @pages;
foreach my $page (blog_list($params{pages}, $params{show})) { foreach my $page (blog_list($params{pages}, $params{show})) {
next if $page eq $parentpage; next if $page eq $params{page};
push @pages, $page; push @pages, $page;
$template->param(pagelink => htmllink($parentpage, $page)); $template->param(pagelink => htmllink($params{page}, $page));
$template->param(content => get_inline_content($parentpage, $page)) $template->param(content => get_inline_content($params{page}, $page))
if $params{archive} eq "no"; if $params{archive} eq "no";
$template->param(ctime => scalar(gmtime($pagectime{$page}))); $template->param(ctime => scalar(gmtime($pagectime{$page})));
$ret.=$template->output; $ret.=$template->output;
@ -248,8 +247,8 @@ sub preprocess_inline ($@) { #{{{
# check_overwrite, but currently renderedfiles # check_overwrite, but currently renderedfiles
# only supports listing one file per page. # only supports listing one file per page.
if ($config{rss}) { if ($config{rss}) {
writefile(rsspage($parentpage), $config{destdir}, writefile(rsspage($params{page}), $config{destdir},
genrss($parentpage, @pages)); genrss($params{page}, @pages));
} }
return $ret; return $ret;