summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/bzr.pm25
-rw-r--r--IkiWiki/Plugin/comments.pm4
-rw-r--r--IkiWiki/Plugin/htmlscrubber.pm2
-rw-r--r--IkiWiki/Plugin/template.pm10
-rw-r--r--IkiWiki/Plugin/txt.pm9
5 files changed, 37 insertions, 13 deletions
diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm
index 1ffdc2353..0efc26b49 100644
--- a/IkiWiki/Plugin/bzr.pm
+++ b/IkiWiki/Plugin/bzr.pm
@@ -73,31 +73,40 @@ sub bzr_log ($) {
my @infos = ();
my $key = undef;
+ my %info;
while (<$out>) {
my $line = $_;
my ($value);
if ($line =~ /^message:/) {
$key = "message";
- $infos[$#infos]{$key} = "";
+ $info{$key} = "";
}
elsif ($line =~ /^(modified|added|renamed|renamed and modified|removed):/) {
$key = "files";
- unless (defined($infos[$#infos]{$key})) { $infos[$#infos]{$key} = ""; }
+ $info{$key} = "" unless defined $info{$key};
}
elsif (defined($key) and $line =~ /^ (.*)/) {
- $infos[$#infos]{$key} .= "$1\n";
+ $info{$key} .= "$1\n";
}
elsif ($line eq "------------------------------------------------------------\n") {
+ push @infos, {%info} if keys %info;
+ %info = ();
$key = undef;
- push (@infos, {});
}
- else {
+ elsif ($line =~ /: /) {
chomp $line;
+ if ($line =~ /^revno: (\d+)/) {
+ $key = "revno";
+ $value = $1;
+ }
+ else {
($key, $value) = split /: +/, $line, 2;
- $infos[$#infos]{$key} = $value;
- }
+ }
+ $info{$key} = $value;
+ }
}
close $out;
+ push @infos, {%info} if keys %info;
return @infos;
}
@@ -213,7 +222,7 @@ sub rcs_recentchanges ($) {
foreach my $info (bzr_log($out)) {
my @pages = ();
my @message = ();
-
+
foreach my $msgline (split(/\n/, $info->{message})) {
push @message, { line => $msgline };
}
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 98786f432..460341710 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -221,7 +221,9 @@ sub preprocess {
}
if (defined $params{subject}) {
- $pagestate{$page}{meta}{title} = $params{subject};
+ # encode title the same way meta does
+ eval q{use HTML::Entities};
+ $pagestate{$page}{meta}{title} = HTML::Entities::encode_numeric(decode_entities($params{subject}));
}
if ($params{page} =~ m/\/\Q$config{comments_pagename}\E\d+_/) {
diff --git a/IkiWiki/Plugin/htmlscrubber.pm b/IkiWiki/Plugin/htmlscrubber.pm
index 26e18ffc7..9f40c752f 100644
--- a/IkiWiki/Plugin/htmlscrubber.pm
+++ b/IkiWiki/Plugin/htmlscrubber.pm
@@ -32,7 +32,7 @@ sub import {
);
# data is a special case. Allow a few data:image/ types,
# but disallow data:text/javascript and everything else.
- $safe_url_regexp=qr/^(?:(?:$uri_schemes):|data:image\/(?:png|jpeg|gif)|[^:]+(?:$|\/))/i;
+ $safe_url_regexp=qr/^(?:(?:$uri_schemes):|data:image\/(?:png|jpeg|gif)|[^:]+(?:$|[\/\?]))/i;
}
sub getsetup () {
diff --git a/IkiWiki/Plugin/template.pm b/IkiWiki/Plugin/template.pm
index 3e024c5f8..98a13b5fa 100644
--- a/IkiWiki/Plugin/template.pm
+++ b/IkiWiki/Plugin/template.pm
@@ -37,7 +37,13 @@ sub preprocess (@) {
my $template_page="templates/$params{id}";
add_depends($params{page}, $template_page);
- my $template_file=$pagesources{$template_page};
+ my $template_file;
+ if (exists $pagesources{$template_page}) {
+ $template_file=srcfile($pagesources{$template_page});
+ }
+ else {
+ $template_file=IkiWiki::template_file("$params{id}.tmpl")
+ }
return sprintf(gettext("template %s not found"),
htmllink($params{page}, $params{destpage}, "/".$template_page))
unless defined $template_file;
@@ -50,7 +56,7 @@ sub preprocess (@) {
$$text_ref=&Encode::decode_utf8($$text_ref);
chomp $$text_ref;
},
- filename => srcfile($template_file),
+ filename => $template_file,
die_on_bad_params => 0,
no_includes => 1,
blind_cache => 1,
diff --git a/IkiWiki/Plugin/txt.pm b/IkiWiki/Plugin/txt.pm
index 1ed9f0856..0d9a0b35b 100644
--- a/IkiWiki/Plugin/txt.pm
+++ b/IkiWiki/Plugin/txt.pm
@@ -39,7 +39,14 @@ sub filter (@) {
my %params = @_;
my $content = $params{content};
- if (defined $pagesources{$params{page}} && $pagesources{$params{page}} =~ /\.txt$/) {
+ if (defined $pagesources{$params{page}} &&
+ $pagesources{$params{page}} =~ /\.txt$/) {
+ if ($pagesources{$params{page}} eq 'robots.txt' &&
+ $params{page} eq $params{destpage}) {
+ will_render($params{page}, 'robots.txt');
+ writefile('robots.txt', $config{destdir}, $content);
+ }
+
encode_entities($content, "<>&");
if ($findurl) {
my $finder = URI::Find->new(sub {