1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
# $Id$
use Test::More tests => 9;
use HTML::FormatText::WithLinks;
my $html = new_html();
my $f = HTML::FormatText::WithLinks->new( leftmargin => 0 );
ok($f, 'object created');
my $text = $f->parse($html);
my $correct_text = qq!This is a mail of some sort with a [1]link.
1. http://example.com/relative.html
!;
my $override_text = qq!This is a mail of some sort with a [1]link.
1. http://example.net/relative.html
!;
ok($text, 'html formatted');
is($text, $correct_text, 'html correctly formatted');
my $f2 = HTML::FormatText::WithLinks->new( leftmargin => 0,
base => 'http://example.net/'
);
ok($f2, 'object created');
my $text2 = $f2->parse($html);
ok($text2, 'html formatted');
is($text2, $override_text, 'html correctly formatted - config base overrides doc');
my $f3 = HTML::FormatText::WithLinks->new( leftmargin => 0,
base => 'http://example.net/',
doc_overrides_base => 1
);
ok($f3, 'object created');
my $text3 = $f3->parse($html);
ok($text3, 'html formatted');
is($text3, $correct_text, 'html correctly formatted - doc overrides config');
sub new_html {
return <<'HTML';
<html>
<head>
<base href="http://example.com/" />
<body>
<p>
This is a mail of some sort with a <a href="/relative.html">link</a>.
</p>
</body>
</html>
HTML
}
|