summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2010-06-29 15:13:23 +0200
committerintrigeri <intrigeri@boum.org>2010-06-29 15:17:56 +0200
commitdcd57dd5c9f3265bb7a78a5696b90976698c43aa (patch)
treec28ea45d18d36e5a0195bef7027b2c0df3b94af1 /IkiWiki/Plugin
parent4f44534d72c9a9a947bc38a3cb4987705c25bea5 (diff)
Add a fullpage arg to filter.
Set it to true every time IkiWiki::filter is called on a full page's content. This is a much nicer solution, for the po plugin, than previous whitelisting using caller().
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/editpage.pm2
-rw-r--r--IkiWiki/Plugin/inline.pm4
-rw-r--r--IkiWiki/Plugin/po.pm6
-rw-r--r--IkiWiki/Plugin/sidebar.pm2
4 files changed, 6 insertions, 8 deletions
diff --git a/IkiWiki/Plugin/editpage.pm b/IkiWiki/Plugin/editpage.pm
index 1a04a72b5..706630203 100644
--- a/IkiWiki/Plugin/editpage.pm
+++ b/IkiWiki/Plugin/editpage.pm
@@ -187,7 +187,7 @@ sub cgi_editpage ($$) {
my $preview=htmlize($page, $page, $type,
linkify($page, $page,
preprocess($page, $page,
- filter($page, $page, $content), 0, 1)));
+ filter($page, $page, $content, 'fullpage'), 0, 1)));
run_hooks(format => sub {
$preview=shift->(
page => $page,
diff --git a/IkiWiki/Plugin/inline.pm b/IkiWiki/Plugin/inline.pm
index 715a3d652..a04dd6630 100644
--- a/IkiWiki/Plugin/inline.pm
+++ b/IkiWiki/Plugin/inline.pm
@@ -403,7 +403,7 @@ sub preprocess_inline (@) {
linkify($page, $params{destpage},
preprocess($page, $params{destpage},
filter($page, $params{destpage},
- readfile(srcfile($file)))));
+ readfile(srcfile($file)), 'fullpage')));
}
else {
$ret.="\n".
@@ -474,7 +474,7 @@ sub get_inline_content ($$) {
linkify($page, $destpage,
preprocess($page, $destpage,
filter($page, $destpage,
- readfile(srcfile($file))))));
+ readfile(srcfile($file)), 'fullpage'))));
$nested--;
if (isinternal($page)) {
# make inlined text of internal pages searchable
diff --git a/IkiWiki/Plugin/po.pm b/IkiWiki/Plugin/po.pm
index ac4401e48..93cf6bbdf 100644
--- a/IkiWiki/Plugin/po.pm
+++ b/IkiWiki/Plugin/po.pm
@@ -259,11 +259,9 @@ sub filter (@) {
my $page = $params{page};
my $destpage = $params{destpage};
my $content = $params{content};
+ my $fullpage = $params{fullpage};
- my @caller = caller(4);
- # FIXME: need to whitelist inline as well?
- unless ($caller[3] eq "IkiWiki::render" ||
- $caller[3] eq 'IkiWiki::Plugin::sidebar::sidebar_content') {
+ unless ($fullpage) {
return $content;
}
diff --git a/IkiWiki/Plugin/sidebar.pm b/IkiWiki/Plugin/sidebar.pm
index 2d495db2c..100015cee 100644
--- a/IkiWiki/Plugin/sidebar.pm
+++ b/IkiWiki/Plugin/sidebar.pm
@@ -89,7 +89,7 @@ sub sidebar_content ($) {
return IkiWiki::htmlize($sidebar_page, $page, $sidebar_type,
IkiWiki::linkify($sidebar_page, $page,
IkiWiki::preprocess($sidebar_page, $page,
- IkiWiki::filter($sidebar_page, $page, $content))));
+ IkiWiki::filter($sidebar_page, $page, $content, 'fullpage'))));
}
}