parselink.html
来自「perl教程」· HTML 代码 · 共 111 行
HTML
111 行
<?xml version="1.0" ?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<!-- saved from url=(0017)http://localhost/ -->
<script language="JavaScript" src="../../displayToc.js"></script>
<script language="JavaScript" src="../../tocParas.js"></script>
<script language="JavaScript" src="../../tocTab.js"></script>
<link rel="stylesheet" type="text/css" href="../../scineplex.css">
<title>Pod::ParseLink - Parse an LE<lt>E<gt> formatting code in POD text</title>
<link rel="stylesheet" href="../../Active.css" type="text/css" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:" />
</head>
<body>
<script>writelinks('__top__',2);</script>
<h1><a>Pod::ParseLink - Parse an LE<lt>E<gt> formatting code in POD text</a></h1>
<p><a name="__index__"></a></p>
<!-- INDEX BEGIN -->
<ul>
<li><a href="#name">NAME</a></li>
<li><a href="#synopsis">SYNOPSIS</a></li>
<li><a href="#description">DESCRIPTION</a></li>
<li><a href="#see_also">SEE ALSO</a></li>
<li><a href="#author">AUTHOR</a></li>
<li><a href="#copyright_and_license">COPYRIGHT AND LICENSE</a></li>
</ul>
<!-- INDEX END -->
<hr />
<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>Pod::ParseLink - Parse an L<> formatting code in POD text</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
<span class="keyword">use</span> <span class="variable">Pod::ParseLink</span><span class="operator">;</span>
<span class="keyword">my</span> <span class="operator">(</span><span class="variable">$text</span><span class="operator">,</span> <span class="variable">$inferred</span><span class="operator">,</span> <span class="variable">$name</span><span class="operator">,</span> <span class="variable">$section</span><span class="operator">,</span> <span class="variable">$type</span><span class="operator">)</span> <span class="operator">=</span> <span class="variable">parselink</span> <span class="operator">(</span><span class="variable">$link</span><span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>This module only provides a single function, parselink(), which takes the
text of an L<> formatting code and parses it. It returns the anchor
text for the link (if any was given), the anchor text possibly inferred from
the name and section, the name or URL, the section if any, and the type of
link. The type will be one of 'url', 'pod', or 'man', indicating a URL, a
link to a POD page, or a link to a Unix manual page.</p>
<p>Parsing is implemented per <a href="../../lib/Pod/perlpodspec.html">the perlpodspec manpage</a>. For backward compatibility,
links where there is no section and name contains spaces, or links where the
entirety of the link (except for the anchor text if given) is enclosed in
double-quotes are interpreted as links to a section (L</section>).</p>
<p>The inferred anchor text is implemented per <a href="../../lib/Pod/perlpodspec.html">the perlpodspec manpage</a>:</p>
<pre>
L<name> => L<name|name>
L</section> => L<"section"|/section>
L<name/section> => L<"section" in name|name/section></pre>
<p>The name may contain embedded E<> and Z<> formatting codes,
and the section, anchor text, and inferred anchor text may contain any
formatting codes. Any double quotes around the section are removed as part
of the parsing, as is any leading or trailing whitespace.</p>
<p>If the text of the L<> escape is entirely enclosed in double quotes,
it's interpreted as a link to a section for backwards compatibility.</p>
<p>No attempt is made to resolve formatting codes. This must be done after
calling parselink (since E<> formatting codes can be used to escape
characters that would otherwise be significant to the parser and resolving
them before parsing would result in an incorrect parse of a formatting code
like:</p>
<pre>
L<verticalE<verbar>barE<sol>slash></pre>
<p>which should be interpreted as a link to the <code>vertical|bar/slash</code> POD page
and not as a link to the <code>slash</code> section of the <code>bar</code> POD page with an
anchor text of <code>vertical</code>. Note that not only the anchor text will need to
have formatting codes expanded, but so will the target of the link (to deal
with E<> and Z<> formatting codes), and special handling of
the section may be necessary depending on whether the translator wants to
consider markup in sections to be significant when resolving links. See
<a href="../../lib/Pod/perlpodspec.html">the perlpodspec manpage</a> for more information.</p>
<p>
</p>
<hr />
<h1><a name="see_also">SEE ALSO</a></h1>
<p><a href="../../lib/Pod/Parser.html">the Pod::Parser manpage</a></p>
<p>The current version of this module is always available from its web site at
<a href="http://www.eyrie.org/~eagle/software/podlators/">http://www.eyrie.org/~eagle/software/podlators/</a>.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Russ Allbery <<a href="mailto:rra@stanford.edu">rra@stanford.edu</a>>.</p>
<p>
</p>
<hr />
<h1><a name="copyright_and_license">COPYRIGHT AND LICENSE</a></h1>
<p>Copyright 2001 by Russ Allbery <<a href="mailto:rra@stanford.edu">rra@stanford.edu</a>>.</p>
<p>This program is free software; you may redistribute it and/or modify it
under the same terms as Perl itself.</p>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?