#!perl BEGIN { chdir 't' if -d 't' } use strict; use warnings; use Test::More tests => 8; use Test::NoWarnings; use Text::MediawikiFormat as => 'wf', implicit_links => 0, absolute_links => 0, process_html => 0; my $wikitext = <<'WIKI'; I download code from http://www.cpan.org/ or ftp://ftp.cpan.org/ and email mailto:chromatic@example.com WIKI my $htmltext = wf( $wikitext, {}, { absolute_links => 1 } ); is $htmltext, qq{

I download code from } . qq{http://www.cpan.org/ } . qq{or ftp://ftp.cpan.org/ and\n} . q{email } . q{mailto:chromatic@example.com} . qq{

\n}, 'Picking up absolute links'; $htmltext = wf( $wikitext, {}, { absolute_links => 0 } ); is $htmltext, qq{

I download code from http://www.cpan.org/ or ftp://ftp.cpan.org/ } . qq{and\n} . q{email mailto:chromatic@example.com} . qq{

\n}, q{Doesn't pick up links when absolute_links is off}; $wikitext = "this is a moose:notalink"; $htmltext = wf( $wikitext, {}, { absolute_links => 1 } ); is $htmltext, qq{

this is a moose:notalink

\n}, q{Doesn't pick up things that might look like links}; $htmltext = wf( $wikitext, { schemas => ['moose'] }, { absolute_links => 1 } ); is $htmltext, qq{

this is a moose:notalink

\n}, q{Schema tag allows specifying what is a link}; $wikitext = <<'WIKI'; http://www.cpan.org/. A link in angle brackets: . WIKI $htmltext = wf( $wikitext, {}, { absolute_links => 1 } ); like $htmltext, qr{href='http://www.cpan.org/'>}, 'Links work at beginning of line and lose cruft'; like $htmltext, qr{org/\.}, 'Cruft restored after link'; like $htmltext, qr{>http://link\.org>\.}, 'Angle brackets around links are left alone';