From 53c122b3bb0c1b44b1f1a0968d728d58d7aee9ae Mon Sep 17 00:00:00 2001 From: "http://john.choffee.co.uk/" Date: Fri, 12 Dec 2008 05:22:53 -0500 Subject: --- ...ubber__95__skip_setting.___40__patch__41__.mdwn | 62 ++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn (limited to 'doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn') diff --git a/doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn b/doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn new file mode 100644 index 000000000..9d67d6662 --- /dev/null +++ b/doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn @@ -0,0 +1,62 @@ +I have been trying to include some meta info using the link setting something like the below + + meta link="http://www.example.com/" rel="command" name="Example" + +This gets removed by the htmlscrubber as you would expect. + +Setting htmlscrubber_skip to the pagespec should stop this getting scrubbed but it does not. + +Below is a patch to fix that. It seams to work but I am not sure of it is the correct thing to do. + +--- meta.pm 2008-12-11 17:50:33.000000000 +0000 ++++ meta.pm.orig 2008-12-10 17:41:23.000000000 +0000 +@@ -38,9 +38,10 @@ + } + } + +-sub scrub (@) { #{{{ ++sub scrub ($) { #{{{ + if (IkiWiki::Plugin::htmlscrubber->can("sanitize")) { +- return IkiWiki::Plugin::htmlscrubber::sanitize(content => shift, destpage => shift); ++ #return IkiWiki::Plugin::htmlscrubber::sanitize(content => shift); ++ return shift; + } + else { + return shift; +@@ -137,7 +138,7 @@ + elsif ($key eq 'permalink') { + if (safeurl($value)) { + $pagestate{$page}{meta}{permalink}=$value; +- push @{$metaheaders{$page}}, scrub('', $page); ++ push @{$metaheaders{$page}}, scrub(''); + } + } + elsif ($key eq 'stylesheet') { +@@ -206,7 +207,7 @@ + my $delay=int(exists $params{delay} ? $params{delay} : 0); + my $redir=""; + if (! $safe) { +- $redir=scrub($redir, $page); ++ $redir=scrub($redir); + } + push @{$metaheaders{$page}}, $redir; + } +@@ -216,7 +217,7 @@ + join(" ", map { + encode_entities($_)."=\"".encode_entities(decode_entities($params{$_}))."\"" + } keys %params). +- " />\n", $page); ++ " />\n"); + } + } + elsif ($key eq 'robots') { +@@ -225,7 +226,7 @@ + } + else { + push @{$metaheaders{$page}}, scrub('', $page); ++ '" content="'.encode_entities($value).'" />'); + } + + return ""; + -- cgit v1.2.3 From 88e8d4bf8d99b6df83deb680f1ed8685e6447875 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 12 Dec 2008 14:06:45 -0500 Subject: meta: Pass info to htmlscrubber so htmlscrubber_skip can take effect. --- IkiWiki/Plugin/meta.pm | 13 +++--- debian/changelog | 1 + ...ubber__95__skip_setting.___40__patch__41__.mdwn | 53 +--------------------- 3 files changed, 9 insertions(+), 58 deletions(-) (limited to 'doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn') diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm index 8d444109f..3991797c0 100644 --- a/IkiWiki/Plugin/meta.pm +++ b/IkiWiki/Plugin/meta.pm @@ -38,9 +38,10 @@ sub needsbuild (@) { #{{{ } } -sub scrub ($) { #{{{ +sub scrub ($$) { #{{{ if (IkiWiki::Plugin::htmlscrubber->can("sanitize")) { - return IkiWiki::Plugin::htmlscrubber::sanitize(content => shift); + return IkiWiki::Plugin::htmlscrubber::sanitize( + content => shift, destpage => shift); } else { return shift; @@ -137,7 +138,7 @@ sub preprocess (@) { #{{{ elsif ($key eq 'permalink') { if (safeurl($value)) { $pagestate{$page}{meta}{permalink}=$value; - push @{$metaheaders{$page}}, scrub(''); + push @{$metaheaders{$page}}, scrub('', $destpage); } } elsif ($key eq 'stylesheet') { @@ -206,7 +207,7 @@ sub preprocess (@) { #{{{ my $delay=int(exists $params{delay} ? $params{delay} : 0); my $redir=""; if (! $safe) { - $redir=scrub($redir); + $redir=scrub($redir, $destpage); } push @{$metaheaders{$page}}, $redir; } @@ -216,7 +217,7 @@ sub preprocess (@) { #{{{ join(" ", map { encode_entities($_)."=\"".encode_entities(decode_entities($params{$_}))."\"" } keys %params). - " />\n"); + " />\n", $destpage); } } elsif ($key eq 'robots') { @@ -225,7 +226,7 @@ sub preprocess (@) { #{{{ } else { push @{$metaheaders{$page}}, scrub(''); + '" content="'.encode_entities($value).'" />', $destpage); } return ""; diff --git a/debian/changelog b/debian/changelog index 1ff78d749..bf14860dd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -13,6 +13,7 @@ ikiwiki (2.71) UNRELEASED; urgency=low * inline: Support emptyfeeds=no option to skip generating empty feeds. * inline: Support feedfile option to change the filename of the feed generated. + * meta: Pass info to htmlscrubber so htmlscrubber_skip can take effect. -- Joey Hess Mon, 17 Nov 2008 14:02:10 -0500 diff --git a/doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn b/doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn index 9d67d6662..0e40da551 100644 --- a/doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn +++ b/doc/bugs/Meta_plugin_does_not_respect_htmlscrubber__95__skip_setting.___40__patch__41__.mdwn @@ -8,55 +8,4 @@ Setting htmlscrubber_skip to the pagespec should stop this getting scrubbed but Below is a patch to fix that. It seams to work but I am not sure of it is the correct thing to do. ---- meta.pm 2008-12-11 17:50:33.000000000 +0000 -+++ meta.pm.orig 2008-12-10 17:41:23.000000000 +0000 -@@ -38,9 +38,10 @@ - } - } - --sub scrub (@) { #{{{ -+sub scrub ($) { #{{{ - if (IkiWiki::Plugin::htmlscrubber->can("sanitize")) { -- return IkiWiki::Plugin::htmlscrubber::sanitize(content => shift, destpage => shift); -+ #return IkiWiki::Plugin::htmlscrubber::sanitize(content => shift); -+ return shift; - } - else { - return shift; -@@ -137,7 +138,7 @@ - elsif ($key eq 'permalink') { - if (safeurl($value)) { - $pagestate{$page}{meta}{permalink}=$value; -- push @{$metaheaders{$page}}, scrub('', $page); -+ push @{$metaheaders{$page}}, scrub(''); - } - } - elsif ($key eq 'stylesheet') { -@@ -206,7 +207,7 @@ - my $delay=int(exists $params{delay} ? $params{delay} : 0); - my $redir=""; - if (! $safe) { -- $redir=scrub($redir, $page); -+ $redir=scrub($redir); - } - push @{$metaheaders{$page}}, $redir; - } -@@ -216,7 +217,7 @@ - join(" ", map { - encode_entities($_)."=\"".encode_entities(decode_entities($params{$_}))."\"" - } keys %params). -- " />\n", $page); -+ " />\n"); - } - } - elsif ($key eq 'robots') { -@@ -225,7 +226,7 @@ - } - else { - push @{$metaheaders{$page}}, scrub('', $page); -+ '" content="'.encode_entities($value).'" />'); - } - - return ""; - +> [[done]], thanks for the patch --[[Joey]] -- cgit v1.2.3