2 package IkiWiki::Plugin::googlecalendar;
9 hook(type => "getsetup", id => "googlecalendar",
11 hook(type => "preprocess", id => "googlecalendar",
12 call => \&preprocess);
13 hook(type => "format", id => "googlecalendar",
28 # Parse the html, looking for the url to embed for the calendar.
30 my ($url)=$params{html}=~m#iframe\s+src="http://www\.google\.com/calendar/embed\?([^"<>]+)"#;
31 if (! defined $url || ! length $url) {
32 error gettext("failed to find url in html")
34 my ($height)=$params{html}=~m#height="(\d+)"#;
35 my ($width)=$params{html}=~m#width="(\d+)"#;
37 return "<div class=\"googlecalendar\" src=\"$url\" height=\"$height\" width=\"$width\"></div>";
43 $params{content}=~s/<div class=\"googlecalendar" src="([^"]+)" height="([^"]+)" width="([^"]+)"><\/div>/gencal($1,$2,$3)/eg;
45 return $params{content};
52 return qq{<iframe src="http://www.google.com/calendar/embed?$url" style=" border-width:0 " width="$width" frameborder="0" height="$height"></iframe>};