From 1dddec0ba9f66f082f4b8349916cdb6bdb5636e3 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 4 Jun 2008 01:24:23 -0400 Subject: Pass a destpage parameter to the sanitize hook. Because the search plugin needed it, also because it's one of the few plugins that didn't already have it. I also considered adding it to htmlize, but I really cannot imagine caring what the destpage is when htmlizing. (I'll probably be poven wrong later.) --- IkiWiki/CGI.pm | 2 +- IkiWiki/Plugin/inline.pm | 2 +- IkiWiki/Plugin/meta.pm | 2 +- IkiWiki/Plugin/search.pm | 4 ++-- IkiWiki/Plugin/sidebar.pm | 2 +- IkiWiki/Plugin/table.pm | 2 +- IkiWiki/Plugin/template.pm | 2 +- IkiWiki/Render.pm | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index 532f9c5f6..8a294e887 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -397,7 +397,7 @@ sub cgi_editpage ($$) { #{{{ ); }); $form->tmpl_param("page_preview", - htmlize($page, $type, + htmlize($page, $page, $type, linkify($page, $page, preprocess($page, $page, filter($page, $page, $content), 0, 1)))); diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm index 7d81e9182..344620ebe 100644 --- a/IkiWiki/Plugin/inline.pm +++ b/IkiWiki/Plugin/inline.pm @@ -352,7 +352,7 @@ sub get_inline_content ($$) { #{{{ my $type=pagetype($file); if (defined $type) { $nested++; - my $ret=htmlize($page, $type, + my $ret=htmlize($page, $destpage, $type, linkify($page, $destpage, preprocess($page, $destpage, filter($page, $destpage, diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 0afe1c362..e2914a78a 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -53,7 +53,7 @@ sub htmlize ($$$) { #{{{ my $page = shift; my $destpage = shift; - return IkiWiki::htmlize($page, pagetype($pagesources{$page}), + return IkiWiki::htmlize($page, $destpage, pagetype($pagesources{$page}), IkiWiki::linkify($page, $destpage, IkiWiki::preprocess($page, $destpage, shift))); } diff --git a/IkiWiki/Plugin/search.pm b/IkiWiki/Plugin/search.pm index 3dc70f0b7..aa0a8085e 100644 --- a/IkiWiki/Plugin/search.pm +++ b/IkiWiki/Plugin/search.pm @@ -57,7 +57,7 @@ my $scrubber; sub index (@) { #{{{ my %params=@_; - return $params{content} if %IkiWiki::preprocessing; + return $params{content} if $IkiWiki::preprocessing{$params{destpage}}; my $db=xapiandb(); my $doc=Search::Xapian::Document->new(); @@ -70,7 +70,7 @@ sub index (@) { #{{{ $title=IkiWiki::pagetitle($params{page}); } - # Remove any html from text to be indexed. + # Remove html from text to be indexed. if (! defined $scrubber) { eval q{use HTML::Scrubber}; if (! $@) { diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm index a49726768..7c2e6e1f6 100644 --- a/IkiWiki/Plugin/sidebar.pm +++ b/IkiWiki/Plugin/sidebar.pm @@ -27,7 +27,7 @@ sub sidebar_content ($) { #{{{ my $content=readfile(srcfile($sidebar_file)); return unless length $content; - return IkiWiki::htmlize($page, $sidebar_type, + return IkiWiki::htmlize($sidebar_page, $page, $sidebar_type, IkiWiki::linkify($sidebar_page, $page, IkiWiki::preprocess($sidebar_page, $page, IkiWiki::filter($sidebar_page, $page, $content)))); diff --git a/IkiWiki/Plugin/table.pm b/IkiWiki/Plugin/table.pm index 20c71e1c7..11474c8f0 100644 --- a/IkiWiki/Plugin/table.pm +++ b/IkiWiki/Plugin/table.pm @@ -175,7 +175,7 @@ sub htmlize ($$$) { #{{{ my $page = shift; my $destpage = shift; - return IkiWiki::htmlize($page, pagetype($pagesources{$page}), + return IkiWiki::htmlize($page, $destpage, pagetype($pagesources{$page}), IkiWiki::preprocess($page, $destpage, shift)); } diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm index 416762fe1..a6e34fcc9 100644 --- a/IkiWiki/Plugin/template.pm +++ b/IkiWiki/Plugin/template.pm @@ -48,7 +48,7 @@ sub preprocess (@) { #{{{ foreach my $param (keys %params) { if ($template->query(name => $param)) { $template->param($param => - IkiWiki::htmlize($params{page}, + IkiWiki::htmlize($params{page}, $params{destpage}, pagetype($pagesources{$params{page}}), $params{$param})); } diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index 3422024d1..272eb239a 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -191,7 +191,7 @@ sub render ($) { #{{{ will_render($page, htmlpage($page), 1); return if $type=~/^_/; - my $content=htmlize($page, $type, + my $content=htmlize($page, $page, $type, linkify($page, $page, preprocess($page, $page, filter($page, $page, @@ -520,7 +520,7 @@ sub commandline_render () { #{{{ $content=filter($page, $page, $content); $content=preprocess($page, $page, $content); $content=linkify($page, $page, $content); - $content=htmlize($page, $type, $content); + $content=htmlize($page, $page, $type, $content); $pagemtime{$page}=(stat($srcfile))[9]; print genpage($page, $content); -- cgit v1.2.3