line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perl6::Pod::FormattingCode::L; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
=pod |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
=head1 NAME |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
Perl6::Pod::FormattingCode::L - handle "L" formatting code |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 SYNOPSIS |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
A standard web URL. For example: |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
This module needs the LAME library |
14
|
|
|
|
|
|
|
(available from L) |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 DESCRIPTION |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
The L<> code is used to specify all kinds of links, filenames, citations, and cross-references (both internal and external). |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
A link specification consists of a scheme specifier terminated by a colon, followed by an external address (in the scheme's preferred syntax), followed by an internal address (again, in the scheme's syntax). All three components are optional, though at least one must be present in any link specification. |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Usually, in schemes where an internal address makes sense, it will be separated from the preceding external address by a #, unless the particular addressing scheme requires some other syntax. When new addressing schemes are created specifically for Perldoc it is strongly recommended that # be used to mark the start of internal addresses. |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=cut |
26
|
|
|
|
|
|
|
|
27
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
81
|
|
28
|
3
|
|
|
3
|
|
14
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
54
|
|
29
|
3
|
|
|
3
|
|
15
|
use Data::Dumper; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
122
|
|
30
|
3
|
|
|
3
|
|
15
|
use Perl6::Pod::FormattingCode; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
64
|
|
31
|
3
|
|
|
3
|
|
13
|
use base 'Perl6::Pod::FormattingCode'; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
205
|
|
32
|
3
|
|
|
3
|
|
14
|
use Perl6::Pod::Utl; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
2252
|
|
33
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub new { |
36
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
37
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new(@_); |
38
|
|
|
|
|
|
|
#parse conntent |
39
|
0
|
|
|
|
|
|
if (0) { |
40
|
|
|
|
|
|
|
my $txt = $self->{'content'}; |
41
|
|
|
|
|
|
|
( $self->{alt_text}, $txt ) = split( /\s*\|\s*/, $txt ) if $txt =~/\|/; |
42
|
|
|
|
|
|
|
#cut scheme |
43
|
|
|
|
|
|
|
if ( $txt =~s/^\s*(\w+):// ) { |
44
|
|
|
|
|
|
|
$self->{scheme} = $1; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
#is_external |
47
|
|
|
|
|
|
|
if ( $txt =~ s%^//%%) { |
48
|
|
|
|
|
|
|
$self->{is_external}='//' |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
#cut address |
51
|
|
|
|
|
|
|
if ($txt =~ /([^\#]*)(?:\#(.*))?/) { |
52
|
|
|
|
|
|
|
$self->{address} = $1 ||''; |
53
|
|
|
|
|
|
|
$self->{section} = $2 || ''; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
} |
56
|
0
|
|
|
|
|
|
return $self; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub to_xhtml { |
60
|
0
|
|
|
0
|
0
|
|
my ( $self, $to ) = @_; |
61
|
0
|
|
|
|
|
|
my $w = $to->w; |
62
|
0
|
|
0
|
|
|
|
my $scheme = $self->{scheme}|| ''; |
63
|
0
|
0
|
0
|
|
|
|
if ( ( $scheme =~ /^https?|.*$/ ) or $self->{section} ) { |
64
|
0
|
|
0
|
|
|
|
my $url = $self->{address} || ''; |
65
|
0
|
0
|
|
|
|
|
$url .= "#" . $self->{section} if $self->{section}; |
66
|
0
|
0
|
0
|
|
|
|
$url = $self->{scheme} . ($scheme =~ /^https?/ ? '//' : '') . $url if $self->{is_external} || ($self->{scheme} && $self->{scheme} eq 'mailto:'); |
|
|
0
|
0
|
|
|
|
|
67
|
0
|
|
|
|
|
|
$w->raw(''); |
68
|
0
|
0
|
|
|
|
|
unless ( $self->{alt_text}) { |
69
|
0
|
|
|
|
|
|
$w->print($url) |
70
|
|
|
|
|
|
|
} else { |
71
|
0
|
|
|
|
|
|
$to->visit(Perl6::Pod::Utl::parse_para($self->{alt_text})) |
72
|
|
|
|
|
|
|
} |
73
|
0
|
|
|
|
|
|
$w->raw(''); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
sub to_docbook { |
78
|
0
|
|
|
0
|
0
|
|
my ( $self, $to ) = @_; |
79
|
0
|
|
|
|
|
|
my $w = $to->w; |
80
|
0
|
|
0
|
|
|
|
my $scheme = $self->{scheme}|| ''; |
81
|
0
|
0
|
0
|
|
|
|
if ( ( $scheme =~ /^https?|.*$/ ) or $self->{section} ) { |
82
|
0
|
|
0
|
|
|
|
my $url = $self->{address} || ''; |
83
|
0
|
0
|
|
|
|
|
$url .= "#" . $self->{section} if $self->{section}; |
84
|
0
|
0
|
0
|
|
|
|
$url = $self->{scheme} . ($scheme =~ /^https?/ ? '//' : '') . $url if $self->{is_external} || ($self->{scheme} && $self->{scheme} eq 'mailto:'); |
|
|
0
|
0
|
|
|
|
|
85
|
0
|
|
|
|
|
|
$w->raw(''); |
86
|
0
|
0
|
|
|
|
|
unless ( $self->{alt_text}) { |
87
|
0
|
|
|
|
|
|
$w->print($url) |
88
|
|
|
|
|
|
|
} else { |
89
|
0
|
|
|
|
|
|
$to->visit(Perl6::Pod::Utl::parse_para($self->{alt_text})) |
90
|
|
|
|
|
|
|
} |
91
|
0
|
|
|
|
|
|
$w->raw(''); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
1; |
95
|
|
|
|
|
|
|
__END__ |