NAME

Text::AutoLink - Perl extension for making hyperlinks in text automatically.

SYNOPSIS

use Text::Hatena::AutoLink;

my $parser = Text::Hatena::AutoLink->new;
my $html = $parser->parse($text);

DESCRIPTION

Text::Hatena::AutoLink makes many hyperlinks in text automatically. Urls or many original syntaxes will be changed into hyperlinks. Many syntaxes are originally used in Hatena Diary (http://d.hatena.ne.jp/).

METHODS

Here are common methods of Text::Hatena::AutoLink.

new
$parser = Text::Hatena::AutoLink->new;
$parser = Text::Hatena::AutoLink->new(
  a_target => '_blank',
  invalid_scheme => ['d', 'tex'],
  scheme_option => {
    id => {
      a_target => '',
    },
    http => {
      title_handler => sub {
        my ($title, $charset) = @_;
        return Jcode->new($title, $charset)->utf8;
      },
    },
  ),
);

creates an instance of Text::Hatena::AutoLink. It will work without any options.

a_target is the target name used in anchors. It can be overwritten by scheme options.

invalid_scheme is an array reference of invalid schemes. The scheme in the array will be skipped.

scheme_option are options for many schemes. You can use some common options and scheme characteristic options.

parse
my $html = $parser->parse($text);

parses text and make links. It returns parsed html.

Text::Hatena::AutoLink Syntax

Text::Hatena::AutoLink supports some simple syntaxes.

http://www.hatena.ne.jp/
[http://www.hatena.ne.jp/:title=Hatena]
[http://www.hatena.ne.jp/images/top/h1.gif:image]
mailto:someone@example.com
asin:4798110523
[tex:x^2+y^2=z^2]
d:id:jkondo

These lines all become into hyperlinks.

[]id:jkondo[]

You can avoid being hyperlinked with 2 pair brackets like the above line.

SEE ALSO

Text::Hatena

AUTHOR

Junya Kondo, <jkondo@hatena.ne.jp>

COPYRIGHT AND LICENSE

Copyright (C) 2005 by Junya Kondo

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.