use warnings;
use strict;
-use IkiWiki;
-use IPC::Open2;
+use IkiWiki 2.00;
sub import { #{{{
- IkiWiki::hook(type => "preprocess", id => "googlecalendar",
+ hook(type => "getsetup", id => "googlecalendar",
+ call => \&getsetup);
+ hook(type => "preprocess", id => "googlecalendar",
call => \&preprocess);
- IkiWiki::hook(type => "format", id => "googlecalendar",
+ hook(type => "format", id => "googlecalendar",
call => \&format);
} # }}}
+sub getsetup () { #{{{
+ return
+ plugin => {
+ safe => 1,
+ rebuild => undef,
+ },
+} #}}}
+
sub preprocess (@) { #{{{
my %params=@_;
# Avoid XSS attacks..
my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#;
if (! defined $url || ! length $url) {
- return "[[googlecalendar failed to find url in html]]";
+ error gettext("failed to find url in html")
}
my ($height)=$params{html}=~m#height="(\d+)"#;
my ($width)=$params{html}=~m#width="(\d+)"#;