Debian Codegraph @

upstream/debian-unstable/man3/Pod::ParseLink.3perl

raw
1 .\" -*- mode: troff; coding: utf-8 -*-
2 .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45)
3 .\"
4 .\" Standard preamble:
5 .\" ========================================================================
6 .de Sp \" Vertical space (when we can't use .PP)
7 .if t .sp .5v
8 .if n .sp
9 ..
10 .de Vb \" Begin verbatim text
11 .ft CW
12 .nf
13 .ne \\$1
14 ..
15 .de Ve \" End verbatim text
16 .ft R
17 .fi
18 ..
19 .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>.
20 .ie n \{\
21 . ds C` ""
22 . ds C' ""
23 'br\}
24 .el\{\
25 . ds C`
26 . ds C'
27 'br\}
28 .\"
29 .\" Escape single quotes in literal strings from groff's Unicode transform.
30 .ie \n(.g .ds Aq \(aq
31 .el .ds Aq '
32 .\"
33 .\" If the F register is >0, we'll generate index entries on stderr for
34 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
35 .\" entries marked with X<> in POD. Of course, you'll have to process the
36 .\" output yourself in some meaningful fashion.
37 .\"
38 .\" Avoid warning from groff about undefined register 'F'.
39 .de IX
40 ..
41 .nr rF 0
42 .if \n(.g .if rF .nr rF 1
43 .if (\n(rF:(\n(.g==0)) \{\
44 . if \nF \{\
45 . de IX
46 . tm Index:\\$1\t\\n%\t"\\$2"
47 ..
48 . if !\nF==2 \{\
49 . nr % 0
50 . nr F 2
51 . \}
52 . \}
53 .\}
54 .rr rF
55 .\" ========================================================================
56 .\"
57 .IX Title "Pod::ParseLink 3perl"
58 .TH Pod::ParseLink 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide"
59 .\" For nroff, turn off justification. Always turn off hyphenation; it makes
60 .\" way too many mistakes in technical documents.
61 .if n .ad l
62 .nh
63 .SH NAME
64 Pod::ParseLink \- Parse an L<> formatting code in POD text
65 .SH SYNOPSIS
66 .IX Header "SYNOPSIS"
67 .Vb 3
68 \& use Pod::ParseLink;
69 \& my $link = get_link();
70 \& my ($text, $inferred, $name, $section, $type) = parselink($link);
71 .Ve
72 .SH DESCRIPTION
73 .IX Header "DESCRIPTION"
74 This module only provides a single function, \fBparselink()\fR, which takes the
75 text of an L<> formatting code and parses it. It returns the
76 anchor text for the link (if any was given), the anchor text possibly
77 inferred from the name and section, the name or URL, the section if any,
78 and the type of link. The type will be one of \f(CW\*(C`url\*(C'\fR, \f(CW\*(C`pod\*(C'\fR, or \f(CW\*(C`man\*(C'\fR,
79 indicating a URL, a link to a POD page, or a link to a Unix manual page.
80 .PP
81 Parsing is implemented per perlpodspec. For backward compatibility,
82 links where there is no section and name contains spaces, or links where the
83 entirety of the link (except for the anchor text if given) is enclosed in
84 double-quotes are interpreted as links to a section (L</section>).
85 .PP
86 The inferred anchor text is implemented per perlpodspec:
87 .PP
88 .Vb 3
89 \& L<name> => L<name|name>
90 \& L</section> => L<"section"|/section>
91 \& L<name/section> => L<"section" in name|name/section>
92 .Ve
93 .PP
94 The name may contain embedded E<> and Z<> formatting codes,
95 and the section, anchor text, and inferred anchor text may contain any
96 formatting codes. Any double quotes around the section are removed as part
97 of the parsing, as is any leading or trailing whitespace.
98 .PP
99 If the text of the L<> escape is entirely enclosed in double
100 quotes, it's interpreted as a link to a section for backward
101 compatibility.
102 .PP
103 No attempt is made to resolve formatting codes. This must be done after
104 calling \fBparselink()\fR (since E<> formatting codes can be used to
105 escape characters that would otherwise be significant to the parser and
106 resolving them before parsing would result in an incorrect parse of a
107 formatting code like:
108 .PP
109 .Vb 1
110 \& L<verticalE<verbar>barE<sol>slash>
111 .Ve
112 .PP
113 which should be interpreted as a link to the \f(CW\*(C`vertical|bar/slash\*(C'\fR POD page
114 and not as a link to the \f(CW\*(C`slash\*(C'\fR section of the \f(CW\*(C`bar\*(C'\fR POD page with an
115 anchor text of \f(CW\*(C`vertical\*(C'\fR. Note that not only the anchor text will need to
116 have formatting codes expanded, but so will the target of the link (to deal
117 with E<> and Z<> formatting codes), and special handling of
118 the section may be necessary depending on whether the translator wants to
119 consider markup in sections to be significant when resolving links. See
120 perlpodspec for more information.
121 .SH AUTHOR
122 .IX Header "AUTHOR"
123 Russ Allbery <[email protected]>
124 .SH "COPYRIGHT AND LICENSE"
125 .IX Header "COPYRIGHT AND LICENSE"
126 Copyright 2001, 2008, 2009, 2014, 2018\-2019, 2022 Russ Allbery <[email protected]>
127 .PP
128 This program is free software; you may redistribute it and/or modify it
129 under the same terms as Perl itself.
130 .SH "SEE ALSO"
131 .IX Header "SEE ALSO"
132 Pod::Parser
133 .PP
134 The current version of this module is always available from its web site at
135 <https://www.eyrie.org/~eagle/software/podlators/>.