line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTML::LinkAdd;
|
2
|
|
|
|
|
|
|
our $VERSION = 0.13; # POD and link titles
|
3
|
|
|
|
|
|
|
|
4
|
1
|
|
|
1
|
|
22576
|
use strict;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
6
|
1
|
|
|
1
|
|
403918
|
use HTML::TokeParser;
|
|
1
|
|
|
|
|
16884
|
|
|
1
|
|
|
|
|
1184
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
HTML::LinkAdd - Add hyperlinks to phrases in HTML documents
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use HTML::LinkAdd;
|
15
|
|
|
|
|
|
|
my $page = new HTML::LinkAdd(
|
16
|
|
|
|
|
|
|
'testinput1.html', {
|
17
|
|
|
|
|
|
|
'the clocks were striking thirteen'=>'footnotes.html#OrwellG-1',
|
18
|
|
|
|
|
|
|
'updated' => ['updated.html', 'View the latest update],
|
19
|
|
|
|
|
|
|
});
|
20
|
|
|
|
|
|
|
warn $page -> hyperlinked;
|
21
|
|
|
|
|
|
|
$page ->save ('output.html');
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
A simple object that accepts a class reference, a path to a file,
|
26
|
|
|
|
|
|
|
and a hash of text-phrase/link-URLs,
|
27
|
|
|
|
|
|
|
and supplies a method to obtain the HTML with supplied hyperlinks interpolated.
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
If the values of the supplied has are anonymous lists, the first value
|
30
|
|
|
|
|
|
|
should a URI, the second escaped text to place in the link's C attribute.
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
The phrase to hyperlink will be skipped if it appears in a context that prevents
|
33
|
|
|
|
|
|
|
linking, as defined in C<%$HTML::LinkAdd::SKIP>. This is currently
|
34
|
|
|
|
|
|
|
C, C |