text.html

来自「perl教程」· HTML 代码 · 共 256 行

HTML
256
字号
<?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::Text - Convert POD data to formatted ASCII 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::Text - Convert POD data to formatted ASCII 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="#diagnostics">DIAGNOSTICS</a></li>
	<li><a href="#restrictions">RESTRICTIONS</a></li>
	<li><a href="#notes">NOTES</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::Text - Convert POD data to formatted ASCII text</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<pre>
    <span class="keyword">use</span> <span class="variable">Pod::Text</span><span class="operator">;</span>
    <span class="keyword">my</span> <span class="variable">$parser</span> <span class="operator">=</span> <span class="variable">Pod::Text</span><span class="operator">-&gt;</span><span class="variable">new</span> <span class="operator">(</span><span class="string">sentence</span> <span class="operator">=&gt;</span> <span class="number">0</span><span class="operator">,</span> <span class="string">width</span> <span class="operator">=&gt;</span> <span class="number">78</span><span class="operator">);</span>
</pre>
<pre>
    <span class="comment"># Read POD from STDIN and write to STDOUT.</span>
    <span class="variable">$parser</span><span class="operator">-&gt;</span><span class="variable">parse_from_filehandle</span><span class="operator">;</span>
</pre>
<pre>
    <span class="comment"># Read POD from file.pod and write to file.txt.</span>
    <span class="variable">$parser</span><span class="operator">-&gt;</span><span class="variable">parse_from_file</span> <span class="operator">(</span><span class="string">'file.pod'</span><span class="operator">,</span> <span class="string">'file.txt'</span><span class="operator">);</span>
</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>Pod::Text is a module that can convert documentation in the POD format (the
preferred language for documenting Perl) into formatted ASCII.  It uses no
special formatting controls or codes whatsoever, and its output is therefore
suitable for nearly any device.</p>
<p>As a derived class from Pod::Parser, Pod::Text supports the same methods and
interfaces.  See <a href="../../lib/Pod/Parser.html">the Pod::Parser manpage</a> for all the details; briefly, one creates a
new parser with <code>Pod::Text-&gt;new()</code> and then calls either
<code>parse_from_filehandle()</code> or parse_from_file().</p>
<p><code>new()</code> can take options, in the form of key/value pairs, that control the
behavior of the parser.  The currently recognized options are:</p>
<dl>
<dt><strong><a name="item_alt">alt</a></strong>

<dd>
<p>If set to a true value, selects an alternate output format that, among other
things, uses a different heading style and marks <code>=item</code> entries with a
colon in the left margin.  Defaults to false.</p>
</dd>
</li>
<dt><strong><a name="item_code">code</a></strong>

<dd>
<p>If set to a true value, the non-POD parts of the input file will be included
in the output.  Useful for viewing code documented with POD blocks with the
POD rendered and the code left intact.</p>
</dd>
</li>
<dt><strong><a name="item_indent">indent</a></strong>

<dd>
<p>The number of spaces to indent regular text, and the default indentation for
<code>=over</code> blocks.  Defaults to 4.</p>
</dd>
</li>
<dt><strong><a name="item_loose">loose</a></strong>

<dd>
<p>If set to a true value, a blank line is printed after a <code>=head1</code> heading.
If set to false (the default), no blank line is printed after <code>=head1</code>,
although one is still printed after <code>=head2</code>.  This is the default because
it's the expected formatting for manual pages; if you're formatting
arbitrary text documents, setting this to true may result in more pleasing
output.</p>
</dd>
</li>
<dt><strong><a name="item_margin">margin</a></strong>

<dd>
<p>The width of the left margin in spaces.  Defaults to 0.  This is the margin
for all text, including headings, not the amount by which regular text is
indented; for the latter, see the <em>indent</em> option.  To set the right
margin, see the <em>width</em> option.</p>
</dd>
</li>
<dt><strong><a name="item_quotes">quotes</a></strong>

<dd>
<p>Sets the quote marks used to surround C&lt;&gt; text.  If the value is a
single character, it is used as both the left and right quote; if it is two
characters, the first character is used as the left quote and the second as
the right quoted; and if it is four characters, the first two are used as
the left quote and the second two as the right quote.</p>
</dd>
<dd>
<p>This may also be set to the special value <code>none</code>, in which case no quote
marks are added around C&lt;&gt; text.</p>
</dd>
</li>
<dt><strong><a name="item_sentence">sentence</a></strong>

<dd>
<p>If set to a true value, Pod::Text will assume that each sentence ends in two
spaces, and will try to preserve that spacing.  If set to false, all
consecutive whitespace in non-verbatim paragraphs is compressed into a
single space.  Defaults to true.</p>
</dd>
</li>
<dt><strong><a name="item_width">width</a></strong>

<dd>
<p>The column at which to wrap text on the right-hand side.  Defaults to 76.</p>
</dd>
</li>
</dl>
<p>The standard Pod::Parser method <code>parse_from_filehandle()</code> takes up to two
arguments, the first being the file handle to read POD from and the second
being the file handle to write the formatted output to.  The first defaults
to STDIN if not given, and the second defaults to STDOUT.  The method
<code>parse_from_file()</code> is almost identical, except that its two arguments are the
input and output disk files instead.  See <a href="../../lib/Pod/Parser.html">the Pod::Parser manpage</a> for the specific
details.</p>
<p>
</p>
<hr />
<h1><a name="diagnostics">DIAGNOSTICS</a></h1>
<dl>
<dt><strong><a name="item_bizarre_space_in_item">Bizarre space in item</a></strong>

<dt><strong><a name="item_item_called_without_tag">Item called without tag</a></strong>

<dd>
<p>(W) Something has gone wrong in internal <code>=item</code> processing.  These
messages indicate a bug in Pod::Text; you should never see them.</p>
</dd>
</li>
<dt><strong><a name="item_can_27t_open__25s_for_reading_3a__25s">Can't open %s for reading: %s</a></strong>

<dd>
<p>(F) Pod::Text was invoked via the compatibility mode <code>pod2text()</code> interface
and the input file it was given could not be opened.</p>
</dd>
</li>
<dt><strong><a name="item_invalid_quote_specification__22_25s_22">Invalid quote specification &quot;%s&quot;</a></strong>

<dd>
<p>(F) The quote specification given (the quotes option to the constructor) was
invalid.  A quote specification must be one, two, or four characters long.</p>
</dd>
</li>
<dt><strong><a name="item__s__d_">%s:%d: Unknown command paragraph: %s</a></strong>

<dd>
<p>(W) The POD source contained a non-standard command paragraph (something of
the form <code>=command args</code>) that Pod::Man didn't know about.  It was ignored.</p>
</dd>
</li>
<dt><strong>%s:%d: Unknown escape: %s</strong>

<dd>
<p>(W) The POD source contained an <code>E&lt;&gt;</code> escape that Pod::Text didn't
know about.</p>
</dd>
</li>
<dt><strong>%s:%d: Unknown formatting code: %s</strong>

<dd>
<p>(W) The POD source contained a non-standard formatting code (something of
the form <code>X&lt;&gt;</code>) that Pod::Text didn't know about.</p>
</dd>
</li>
<dt><strong>%s:%d: Unmatched =back</strong>

<dd>
<p>(W) Pod::Text encountered a <code>=back</code> command that didn't correspond to an
<code>=over</code> command.</p>
</dd>
</li>
</dl>
<p>
</p>
<hr />
<h1><a name="restrictions">RESTRICTIONS</a></h1>
<p>Embedded Ctrl-As (octal 001) in the input will be mapped to spaces on
output, due to an internal implementation detail.</p>
<p>
</p>
<hr />
<h1><a name="notes">NOTES</a></h1>
<p>This is a replacement for an earlier Pod::Text module written by Tom
Christiansen.  It has a revamped interface, since it now uses Pod::Parser,
but an interface roughly compatible with the old Pod::Text::pod2text()
function is still available.  Please change to the new calling convention,
though.</p>
<p>The original Pod::Text contained code to do formatting via termcap
sequences, although it wasn't turned on by default and it was problematic to
get it to work at all.  This rewrite doesn't even try to do that, but a
subclass of it does.  Look for <a href="../../lib/Pod/Text/Termcap.html">the Pod::Text::Termcap manpage</a>.</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>, <a href="../../lib/Pod/Text/Termcap.html">the Pod::Text::Termcap manpage</a>, <em>pod2text(1)</em></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>.  It is also part of the
Perl core distribution as of 5.6.0.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Russ Allbery &lt;<a href="mailto:rra@stanford.edu">rra@stanford.edu</a>&gt;, based <em>very</em> heavily on the original
Pod::Text by Tom Christiansen &lt;<a href="mailto:tchrist@mox.perl.com">tchrist@mox.perl.com</a>&gt; and its conversion to
Pod::Parser by Brad Appleton &lt;<a href="mailto:bradapp@enteract.com">bradapp@enteract.com</a>&gt;.</p>
<p>
</p>
<hr />
<h1><a name="copyright_and_license">COPYRIGHT AND LICENSE</a></h1>
<p>Copyright 1999, 2000, 2001, 2002 by Russ Allbery &lt;<a href="mailto:rra@stanford.edu">rra@stanford.edu</a>&gt;.</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 + -
显示快捷键?