Merge branch 'filter-full'

master
Joey Hess 2010-07-12 15:35:40 -04:00
commit fd2b2f386f
9 changed files with 19 additions and 27 deletions

View File

@ -61,12 +61,11 @@ sub replace_preserved_style ($) {
sub preprocess (@) {
my %params = @_;
# Preprocess the text to expand any preprocessor directives
# embedded inside it.
$params{text} = IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
return preserve_style($params{foreground}, $params{background}, $params{text});
return preserve_style($params{foreground}, $params{background},
# Preprocess the text to expand any preprocessor directives
# embedded inside it.
IkiWiki::preprocess($params{page}, $params{destpage},
$params{text}));
}
sub format (@) {

View File

@ -143,8 +143,6 @@ sub preprocess {
}
$content =~ s/\\"/"/g;
$content = IkiWiki::filter($page, $params{destpage}, $content);
if ($config{comments_allowdirectives}) {
$content = IkiWiki::preprocess($page, $params{destpage},
$content);

View File

@ -59,8 +59,7 @@ sub preprocess_if (@) {
else {
$ret="";
}
return IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage}, $ret));
return IkiWiki::preprocess($params{page}, $params{destpage}, $ret);
}
package IkiWiki::PageSpec;

View File

@ -50,8 +50,8 @@ sub preprocess_copy (@) {
$savedtext{$params{page}} = {} if not exists $savedtext{$params{"page"}};
$savedtext{$params{page}}->{$params{id}} = $params{text};
return IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage}, $params{text})) if defined wantarray;
return IkiWiki::preprocess($params{page}, $params{destpage}, $params{text})
if defined wantarray;
}
sub preprocess_paste (@) {
@ -70,8 +70,8 @@ sub preprocess_paste (@) {
error sprintf(gettext('no text was copied in this page with id %s'), $params{id});
}
return IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage}, $savedtext{$params{page}}->{$params{id}}));
return IkiWiki::preprocess($params{page}, $params{destpage},
$savedtext{$params{page}}->{$params{id}});
}
1;

View File

@ -33,9 +33,9 @@ sub preprocess (@) {
anchor => "more");
}
else {
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
return "<a name=\"more\"></a>\n\n".$params{text};
return "<a name=\"more\"></a>\n\n".
IkiWiki::preprocess($params{page}, $params{destpage},
$params{text});
}
}

View File

@ -47,8 +47,7 @@ sub preprocess (@) {
$pagesidebar{$page}=
IkiWiki::htmlize($page, $page, $type,
IkiWiki::linkify($page, $page,
IkiWiki::preprocess($page, $page,
IkiWiki::filter($page, $page, $params{content}))));
IkiWiki::preprocess($page, $page, $params{content})));
}
return "";

View File

@ -53,8 +53,7 @@ sub preprocess (@) {
foreach my $param (keys %params) {
my $value=IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage},
$params{$param}), $scan);
$params{$param}, $scan);
if ($template->query(name => $param)) {
my $htmlvalue=IkiWiki::htmlize($params{page}, $params{destpage},
pagetype($pagesources{$params{page}}),
@ -69,8 +68,7 @@ sub preprocess (@) {
}
return IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage},
$template->output), $scan);
$template->output, $scan);
}
1

View File

@ -50,8 +50,7 @@ sub preprocess_toggleable (@) {
# Preprocess the text to expand any preprocessor directives
# embedded inside it.
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage}, $params{text});
my $id=genid($params{page}, $params{id});
my $class=(lc($params{open}) ne "yes") ? "toggleable" : "toggleable-open";

View File

@ -198,8 +198,8 @@ value is ignored.
hook(type => "filter", id => "foo", call => \&filter);
Runs on the raw source of a page, before anything else touches it, and can
make arbitrary changes. The function is passed named parameters "page",
Runs on the full raw source of a page, before anything else touches it, and
can make arbitrary changes. The function is passed named parameters "page",
"destpage", and "content". It should return the filtered content.
### preprocess