]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/googlecalendar.pm
Merge branch 'pub/po' into pub/master
[git.ikiwiki.info.git] / IkiWiki / Plugin / googlecalendar.pm
index c6abeb717d96ca7cdc16bd3e7f15e130b2d99d55..81a3ad677fa9d1d2b7ab66d6b2792e3130f158f1 100644 (file)
@@ -3,16 +3,25 @@ package IkiWiki::Plugin::googlecalendar;
 
 use warnings;
 use strict;
 
 use warnings;
 use strict;
-use IkiWiki;
-use IPC::Open2;
+use IkiWiki 2.00;
 
 sub import { #{{{
 
 sub import { #{{{
+       hook(type => "getsetup", id => "googlecalendar",
+               call => \&getsetup);
        hook(type => "preprocess", id => "googlecalendar",
                call => \&preprocess);
        hook(type => "format", id => "googlecalendar",
                call => \&format);
 } # }}}
 
        hook(type => "preprocess", id => "googlecalendar",
                call => \&preprocess);
        hook(type => "format", id => "googlecalendar",
                call => \&format);
 } # }}}
 
+sub getsetup () { #{{{
+       return
+               plugin => {
+                       safe => 1,
+                       rebuild => undef,
+               },
+} #}}}
+
 sub preprocess (@) { #{{{
        my %params=@_;
 
 sub preprocess (@) { #{{{
        my %params=@_;
 
@@ -20,7 +29,7 @@ sub preprocess (@) { #{{{
        # Avoid XSS attacks..
        my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#;
        if (! defined $url || ! length $url) {
        # 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+)"#;
        }
        my ($height)=$params{html}=~m#height="(\d+)"#;
        my ($width)=$params{html}=~m#width="(\d+)"#;