#!/usr/bin/perl package IkiWiki::Plugin::googlecalendar; use warnings; use strict; use IkiWiki 2.00; print STDERR "warning: the googlecalendar plugin is deprecated and will be removed in ikiwiki 3.0 (use the embed plugin instead)\n"; sub import { hook(type => "getsetup", id => "googlecalendar", call => \&getsetup); 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=@_; # Parse the html, looking for the url to embed for the calendar. # Avoid XSS attacks.. my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#; if (! defined $url || ! length $url) { error gettext("failed to find url in html") } my ($height)=$params{html}=~m#height="(\d+)"#; my ($width)=$params{html}=~m#width="(\d+)"#; return "
"; } sub format (@) { my %params=@_; $params{content}=~s/