summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/aggregate.pm7
-rw-r--r--IkiWiki/Plugin/meta.pm26
2 files changed, 24 insertions, 9 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 9c28651f0..98e534366 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -188,7 +188,8 @@ sub aggregate () { #{{{
die $@ if $@;
foreach my $feed (values %feeds) {
- next unless time - $feed->{lastupdate} >= $feed->{updateinterval};
+ next unless $IkiWiki::config{rebuild} ||
+ time - $feed->{lastupdate} >= $feed->{updateinterval};
$feed->{lastupdate}=time;
$feed->{newposts}=0;
$IkiWiki::forcerebuild{$feed->{sourcepage}}=1;
@@ -277,7 +278,7 @@ sub add_page (@) { #{{{
eval q{use Digest::MD5 'md5_hex'};
require Encode;
my $digest=md5_hex(Encode::encode_utf8($params{content}));
- return unless ! exists $guid->{md5} || $guid->{md5} ne $digest;
+ return unless ! exists $guid->{md5} || $guid->{md5} ne $digest || $IkiWiki::config{rebuild};
$guid->{md5}=$digest;
# Create the page.
@@ -285,6 +286,8 @@ sub add_page (@) { #{{{
my $content=$params{content};
$params{content}=~s/(?<!\\)\[\[/\\\[\[/g; # escape accidental wikilinks
# and preprocessor stuff
+ $template->param(title => $params{title})
+ if defined $params{title} && length($params{title});
$template->param(content => $params{content});
$template->param(url => $feed->{url});
$template->param(name => $feed->{name});
diff --git a/IkiWiki/Plugin/meta.pm b/IkiWiki/Plugin/meta.pm
index 15a8bad84..bac163469 100644
--- a/IkiWiki/Plugin/meta.pm
+++ b/IkiWiki/Plugin/meta.pm
@@ -12,10 +12,20 @@ my %title;
sub import { #{{{
IkiWiki::hook(type => "preprocess", id => "meta",
call => \&preprocess);
+ IkiWiki::hook(type => "filter", id => "meta",
+ call => \&filter);
IkiWiki::hook(type => "pagetemplate", id => "meta",
call => \&pagetemplate);
} # }}}
+sub filter (@) { #{{{
+ my %params=@_;
+
+ $meta{$params{page}}='';
+
+ return $params{content};
+} # }}}
+
sub preprocess (@) { #{{{
if (! @_) {
return "";
@@ -28,13 +38,15 @@ sub preprocess (@) { #{{{
delete $params{page};
delete $params{destpage};
- eval q{use CGI 'escapeHTML'};
+ eval q{use HTML::Entities};
+ # Always dencode, even if encoding later, since it might not be
+ # fully encoded.
+ $value=decode_entities($value);
if ($key eq 'link') {
if (%params) {
- $meta{$page}='' unless exists $meta{$page};
- $meta{$page}.="<link href=\"".escapeHTML($value)."\" ".
- join(" ", map { escapeHTML("$_=\"$params{$_}\"") } keys %params).
+ $meta{$page}.="<link href=\"".encode_entities($value)."\" ".
+ join(" ", map { encode_entities($_)."=\"".encode_entities(decode_entities($params{$_}))."\"" } keys %params).
" />\n";
}
else {
@@ -43,11 +55,11 @@ sub preprocess (@) { #{{{
}
}
elsif ($key eq 'title') {
- $title{$page}=escapeHTML($value);
+ $title{$page}=$value;
}
else {
- $meta{$page}='' unless exists $meta{$page};
- $meta{$page}.="<meta name=\"".escapeHTML($key)."\" content=\"".escapeHTML($value)."\" />\n";
+ $meta{$page}.="<meta name=\"".encode_entities($key).
+ "\" content=\"".encode_entities($value)."\" />\n";
}
return "";