return $content;
} #}}}
-sub filter ($$) { #{{{
+sub filter ($$$) { #{{{
my $page=shift;
+ my $destpage=shift;
my $content=shift;
run_hooks(filter => sub {
- $content=shift->(page => $page, content => $content);
+ $content=shift->(page => $page, destpage => $destpage,
+ content => $content);
});
return $content;
htmlize($page, $type,
linkify($page, "",
preprocess($page, $page,
- filter($page, $form->field('editcontent')), 0, 1))));
+ filter($page, $page, $form->field('editcontent')), 0, 1))));
}
else {
$form->tmpl_param("page_preview", "");
$ret="";
}
return IkiWiki::preprocess($params{page}, $params{destpage},
- IkiWiki::filter($params{page}, $ret));
+ IkiWiki::filter($params{page}, $params{destpage}, $ret));
} # }}}
package IkiWiki::PageSpec;
$ret.="\n".
linkify($page, $params{page},
preprocess($page, $params{page},
- filter($page,
+ filter($page, $params{page},
readfile(srcfile($file)))));
}
}
return htmlize($page, $type,
linkify($page, $destpage,
preprocess($page, $destpage,
- filter($page,
+ filter($page, $destpage,
readfile(srcfile($file))))));
}
else {
}
else {
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
- IkiWiki::filter($params{page}, $params{text}));
+ IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
return "<a name=\"more\"></a>\n\n".$params{text};
}
}
return IkiWiki::htmlize($page, $sidebar_type,
IkiWiki::linkify($sidebar_page, $page,
IkiWiki::preprocess($sidebar_page, $page,
- IkiWiki::filter($sidebar_page, $content))));
+ IkiWiki::filter($sidebar_page, $page, $content))));
}
} # }}}
build_regexp() unless defined $smiley_regexp;
$params{content} =~ s{(?:^|(?<=\s))(\\?)$smiley_regexp(?:(?=\s)|$)}{
- $1 ? $2 : htmllink($params{page}, $params{page}, $smileys{$2}, linktext => $2)
+ $1 ? $2 : htmllink($params{page}, $params{destpage}, $smileys{$2}, linktext => $2)
}egs if length $smiley_regexp;
return $params{content};
}
return IkiWiki::preprocess($params{page}, $params{destpage},
- IkiWiki::filter($params{page},
+ IkiWiki::filter($params{page}, $params{destpage},
$template->output));
} # }}}
# Preprocess the text to expand any preprocessor directives
# embedded inside it.
$params{text}=IkiWiki::preprocess($params{page}, $params{destpage},
- IkiWiki::filter($params{page}, $params{text}));
+ IkiWiki::filter($params{page}, $params{destpage}, $params{text}));
my $id=genid($params{page}, $params{id});
# Always needs to be done, since filters might add links
# to the content.
- $content=filter($page, $content);
+ $content=filter($page, $page, $content);
my @links;
while ($content =~ /(?<!\\)$config{wiki_link_regexp}/g) {
my $type=pagetype($file);
my $srcfile=srcfile($file);
if (defined $type) {
- my $content=readfile($srcfile);
my $page=pagename($file);
delete $depends{$page};
will_render($page, htmlpage($page), 1);
- $content=filter($page, $content);
- $content=preprocess($page, $page, $content);
- $content=linkify($page, $page, $content);
- $content=htmlize($page, $type, $content);
+ my $content=htmlize($page, $type,
+ linkify($page, $page,
+ preprocess($page, $page,
+ filter($page, $page,
+ readfile($srcfile)))));
writefile(htmlpage($page), $config{destdir},
genpage($page, $content, mtime($srcfile)));
my $content=readfile($srcfile);
my $page=pagename($file);
$pagesources{$page}=$file;
- $content=filter($page, $content);
+ $content=filter($page, $page, $content);
$content=preprocess($page, $page, $content);
$content=linkify($page, $page, $content);
$content=htmlize($page, $type, $content);
- If the password is empty in preferences, don't clear the existing
password.
- Actually check the confirm password field, even if it's left empty.
+ * Add a destpage parameter to the filter hook.
+ * Fix links to smilies generated by the smiley plugin for inlined pages. The
+ old links were often wrong, but often still worked by accident.
- -- Joey Hess <joeyh@debian.org> Thu, 17 May 2007 04:02:04 -0400
+ -- Joey Hess <joeyh@debian.org> Thu, 17 May 2007 15:14:42 -0400
ikiwiki (2.00) unstable; urgency=low
RSS output contains relative links. Ie.
http://kitenet.net/~joey/blog/index.rss contains a link to
http://kitenet.net/~joey/blog/../blog.html
+
+> I think I've fixed the last of these, but not 100% sure. Calling it
+> [[done]] for now. --[[Joey]]
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` and
-`content` and should return the filtered content.
+make arbitrary changes. The function is passed named parameters "page",
+"destpage", and "content". It should return the filtered content.
### preprocess