# Blosxom Plugin: galleryref
# Author(s): John Slee
# Version 0.1

package googletag;

sub googlize {
	my ($a) = (@_);
	my $b = $a; $b =~ s/\s/+/g;
	qq{<a target=_blank href="http://www.google.com/search?q=$b">$a</a>};
}

sub xlate_googletags {
	my ($text_ref) = @_;
	$$text_ref =~ s{<google>([^>]*)</google>}{googlize($1)}meg;
	
	1;
}

sub start {
	1;
}

sub head {
	my ($pkg, $currentdir, $head_ref) = @_;

	xlate_googletags($head_ref);
	
	1;
}

sub story {
	my ($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;

	xlate_googletags($body_ref);
	xlate_googletags($title_ref);
	xlate_googletags($story_ref);

	1;
}

sub foot {
	my($pkg, $currentdir, $foot_ref) = @_;
	xlate_googletags($foot_ref);

	1;
}

1;
