Apache-Clickable
view release on metacpan or search on metacpan
lib/Apache/Clickable.pm view on Meta::CPAN
$orig_uri);
});
# replace Emails
unless (uc($self->{apr}->dir_config('ClickableEmail')) eq 'OFF') {
find_emails($input, sub {
my($email, $orig_email) = @_;
return sprintf(qq(<a href="mailto:%s">%s</a>),
$orig_email, $orig_email);
});
}
return $input;
};
}
return $sub;
}
1;
__END__
=head1 NAME
Apache::Clickable - Make URLs and Emails in HTML clickable
=head1 SYNOPSIS
# in httpd.conf
<Location /clickable>
SetHandler perl-script
PerlHandler Apache::Clickable
</Location>
# filter aware
PerlModule Apache::Clickable
SetHandler perl-script
PerlSetVar Filter On
PerlHandler Apache::Clickable Apache::AntiSpam Apache::Compress
=head1 DESCRIPTION
Apache::Clickable is a filter to make URLs in HTML clickable. With
URI::Find and Email::Find, this module finds URL and Email in HTML
document, and automatically constructs hyperlinks for them.
For example,
<body>
Documentation is available at http://www.foobar.com/ freely.<P>
someone@foobar.com
</body>
This HTML would be filtered to:
<body>
Documentation is available at <a href="http://www.foobar.com/">http://www.foobar.com</a> freely.<P>
<a href="mailto:someone@foobar.com">someone@foobar.com</a>
</body>
This module is Filter aware, meaning that it can work within
Apache::Filter framework without modification.
=head1 CONFIGURATION
PerlSetVar ClickableTarget _blank
PerlSetVar ClickableEmail Off
=over 4
=item ClickableTarget
PerlSetVar ClickableTarget _blank
specifies target window name of hyperlinks. If set "_blank" for
example, it filters to:
<a href="http://www.foobar.com/" target="_blank">http://www.foobar.com/</a>
None by default.
=item ClickableEmail
PerlSetVar ClickableEmail Off
specifies whether it makes email clickable. On by default. See
L<Apache::AntiSpam> for more.
=back
=head1 TODO
=over 4
=item *
Configurable hyperlink construction using subclass.
=item *
Currently, this module requires HTML::Parser, not to make duplicate
hyperlinks. Maybe this can be done without HTML::Parser.
=back
=head1 AUTHOR
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 SEE ALSO
L<Apache::Filter>, L<Apache::AntiSpam>, L<URI::Find>, L<Email::Find>, L<HTML::Parser>
=cut
( run in 2.207 seconds using v1.01-cache-2.11-cpan-df04353d9ac )