2 package IkiWiki::Plugin::googlecalendar;
8 print STDERR "warning: the googlecalendar plugin is deprecated and will be removed in ikiwiki 3.0 (use the embed plugin instead)\n";
11 hook(type => "getsetup", id => "googlecalendar",
13 hook(type => "preprocess", id => "googlecalendar",
14 call => \&preprocess);
15 hook(type => "format", id => "googlecalendar",
30 # Parse the html, looking for the url to embed for the calendar.
32 my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#;
33 if (! defined $url || ! length $url) {
34 error gettext("failed to find url in html")
36 my ($height)=$params{html}=~m#height="(\d+)"#;
37 my ($width)=$params{html}=~m#width="(\d+)"#;
39 return "<div class=\"googlecalendar\" src=\"$url\" height=\"$height\" width=\"$width\"></div>";
45 $params{content}=~s/<div class=\"googlecalendar" src="([^"]+)" height="([^"]+)" width="([^"]+)"><\/div>/gencal($1,$2,$3)/eg;
47 return $params{content};
54 return qq{<iframe src="http://www.google.com/calendar/embed?$url" style=" border-width:0 " width="$width" frameborder="0" height="$height"></iframe>};