aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2013-06-27 00:50:17 -0400
committerAmitai Schlair <schmonz-web-ikiwiki@schmonz.com>2013-06-27 00:50:17 -0400
commit844710c0dad4e35213ca1b55a660ab6c0a525dd8 (patch)
tree42708fb29692cb14331d650750ddae4710bb466d /IkiWiki
parentb25f7700bde4981d1fb69d89c1451abc0c7bb87a (diff)
parent898ceaf38ca090631a598d0b8b1d6994acc66b59 (diff)
downloadikiwiki-844710c0dad4e35213ca1b55a660ab6c0a525dd8.tar
ikiwiki-844710c0dad4e35213ca1b55a660ab6c0a525dd8.tar.gz
Merge branch 'master' into fancypodcast
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/blogspam.pm1
-rw-r--r--IkiWiki/Plugin/bzr.pm2
-rw-r--r--IkiWiki/Plugin/calendar.pm43
-rw-r--r--IkiWiki/Plugin/comments.pm21
-rw-r--r--IkiWiki/Plugin/notifyemail.pm1
-rw-r--r--IkiWiki/Plugin/osm.pm1
-rw-r--r--IkiWiki/Plugin/theme.pm9
7 files changed, 68 insertions, 10 deletions
diff --git a/IkiWiki/Plugin/blogspam.pm b/IkiWiki/Plugin/blogspam.pm
index d32c2f169..e48ed729f 100644
--- a/IkiWiki/Plugin/blogspam.pm
+++ b/IkiWiki/Plugin/blogspam.pm
@@ -53,6 +53,7 @@ sub checkconfig () {
eval q{
use RPC::XML;
use RPC::XML::Client;
+ $RPC::XML::ENCODING = 'utf-8';
};
error $@ if $@;
}
diff --git a/IkiWiki/Plugin/bzr.pm b/IkiWiki/Plugin/bzr.pm
index 72552abcc..99a07d2c0 100644
--- a/IkiWiki/Plugin/bzr.pm
+++ b/IkiWiki/Plugin/bzr.pm
@@ -195,7 +195,7 @@ sub rcs_add ($) {
sub rcs_remove ($) {
my ($file) = @_;
- my @cmdline = ("bzr", "rm", "--force", "--quiet", "$config{srcdir}/$file");
+ my @cmdline = ("bzr", "rm", "--quiet", "$config{srcdir}/$file");
if (system(@cmdline) != 0) {
warn "'@cmdline' failed: $!";
}
diff --git a/IkiWiki/Plugin/calendar.pm b/IkiWiki/Plugin/calendar.pm
index d443198f6..8ca6dd826 100644
--- a/IkiWiki/Plugin/calendar.pm
+++ b/IkiWiki/Plugin/calendar.pm
@@ -86,8 +86,10 @@ sub format_month (@) {
my $year = $date[5] + 1900;
my $mtag = sprintf("%02d", $month);
- # Only one posting per day is being linked to.
- $linkcache{"$year/$mtag/$mday"} = $p;
+ if (! $linkcache{"$year/$mtag/$mday"}) {
+ $linkcache{"$year/$mtag/$mday"} = [];
+ }
+ push(@{$linkcache{"$year/$mtag/$mday"}}, $p);
}
my $pmonth = $params{month} - 1;
@@ -221,11 +223,38 @@ EOF
$tag='month-calendar-day-link';
}
$calendar.=qq{\t\t<td class="$tag $downame{$wday}">};
- $calendar.=htmllink($params{page}, $params{destpage},
- $linkcache{$key},
- noimageinline => 1,
- linktext => $day,
- title => pagetitle(IkiWiki::basename($linkcache{$key})));
+ if (scalar(@{$linkcache{$key}}) == 1) {
+ # Only one posting on this page
+ my $page = $linkcache{$key}[0];
+ $calendar.=htmllink($params{page}, $params{destpage},
+ $page,
+ noimageinline => 1,
+ linktext => $day,
+ title => pagetitle(IkiWiki::basename($page)));
+ }
+ else {
+ $calendar.=qq{<div class='popup'>$day<div class='balloon'>};
+ # Several postings on this page
+ $calendar.=qq{<ul>};
+ foreach my $page (@{$linkcache{$key}}) {
+ $calendar.= qq{\n\t\t\t<li>};
+ my $title;
+ if (exists $pagestate{$page}{meta}{title}) {
+ $title = "$pagestate{$page}{meta}{title}";
+ }
+ else {
+ $title = pagetitle(IkiWiki::basename($page));
+ }
+ $calendar.=htmllink($params{page}, $params{destpage},
+ $page,
+ noimageinline => 1,
+ linktext => $title,
+ title => $title);
+ $calendar.= '</li>';
+ }
+ $calendar.=qq{\n\t\t</ul>};
+ $calendar.=qq{</div></div>};
+ }
$calendar.=qq{</td>\n};
}
else {
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index c00bf5275..1ef79a27a 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -90,6 +90,15 @@ sub getsetup () {
safe => 0,
rebuild => 0,
},
+ comments_allowformats => {
+ type => 'string',
+ default => '',
+ example => 'mdwn txt',
+ description => 'Restrict formats for comments to (no restriction if empty)',
+ safe => 1,
+ rebuild => 0,
+ },
+
}
sub checkconfig () {
@@ -101,6 +110,8 @@ sub checkconfig () {
unless defined $config{comments_closed_pagespec};
$config{comments_pagename} = 'comment_'
unless defined $config{comments_pagename};
+ $config{comments_allowformats} = ''
+ unless defined $config{comments_allowformats};
}
sub htmlize {
@@ -128,12 +139,18 @@ sub safeurl ($) {
}
}
+sub isallowed ($) {
+ my $format = shift;
+ return ! $config{comments_allowformats} || $config{comments_allowformats} =~ /\b$format\b/;
+}
+
sub preprocess {
my %params = @_;
my $page = $params{page};
my $format = $params{format};
- if (defined $format && ! exists $IkiWiki::hooks{htmlize}{$format}) {
+ if (defined $format && (! exists $IkiWiki::hooks{htmlize}{$format} ||
+ ! isallowed($format))) {
error(sprintf(gettext("unsupported page format %s"), $format));
}
@@ -332,7 +349,7 @@ sub editcomment ($$) {
my @page_types;
if (exists $IkiWiki::hooks{htmlize}) {
- foreach my $key (grep { !/^_/ } keys %{$IkiWiki::hooks{htmlize}}) {
+ foreach my $key (grep { !/^_/ && isallowed($_) } keys %{$IkiWiki::hooks{htmlize}}) {
push @page_types, [$key, $IkiWiki::hooks{htmlize}{$key}{longname} || $key];
}
}
diff --git a/IkiWiki/Plugin/notifyemail.pm b/IkiWiki/Plugin/notifyemail.pm
index 2c1775f2e..b50a22a00 100644
--- a/IkiWiki/Plugin/notifyemail.pm
+++ b/IkiWiki/Plugin/notifyemail.pm
@@ -78,6 +78,7 @@ sub anonsubscribe ($$) {
sub notify (@) {
my @files=@_;
return unless @files;
+ return if $config{rebuild};
eval q{use Mail::Sendmail};
error $@ if $@;
diff --git a/IkiWiki/Plugin/osm.pm b/IkiWiki/Plugin/osm.pm
index a7baa5f2b..c9650d014 100644
--- a/IkiWiki/Plugin/osm.pm
+++ b/IkiWiki/Plugin/osm.pm
@@ -192,6 +192,7 @@ sub process_waypoint {
}
}
$icon = urlto($icon, $dest, 1);
+ $icon =~ s!/*$!!; # hack - urlto shouldn't be appending a slash in the first place
$tag = '' unless $tag;
register_rendered_files($map, $page, $dest);
$pagestate{$page}{'osm'}{$map}{'waypoints'}{$name} = {
diff --git a/IkiWiki/Plugin/theme.pm b/IkiWiki/Plugin/theme.pm
index ee94547e9..9b84ea7f0 100644
--- a/IkiWiki/Plugin/theme.pm
+++ b/IkiWiki/Plugin/theme.pm
@@ -9,6 +9,7 @@ sub import {
hook(type => "getsetup", id => "theme", call => \&getsetup);
hook(type => "checkconfig", id => "theme", call => \&checkconfig);
hook(type => "needsbuild", id => "theme", call => \&needsbuild);
+ hook(type => "pagetemplate", id => "theme", call => \&pagetemplate);
}
sub getsetup () {
@@ -63,4 +64,12 @@ sub needsbuild ($) {
return $needsbuild;
}
+sub pagetemplate (@) {
+ my %params=@_;
+ my $template=$params{template};
+ if (exists $config{theme} && length $config{theme}) {
+ $template->param("theme_$config{theme}" => 1);
+ }
+}
+
1