Initial commit of OpenSPARC T2 design and verification files.
[OpenSPARC-T2-DV] / tools / perl-5.8.0 / man / man1 / perlpodspec.1
CommitLineData
86530b38
AT
1.\" Automatically generated by Pod::Man v1.34, Pod::Parser v1.13
2.\"
3.\" Standard preamble:
4.\" ========================================================================
5.de Sh \" Subsection heading
6.br
7.if t .Sp
8.ne 5
9.PP
10\fB\\$1\fR
11.PP
12..
13.de Sp \" Vertical space (when we can't use .PP)
14.if t .sp .5v
15.if n .sp
16..
17.de Vb \" Begin verbatim text
18.ft CW
19.nf
20.ne \\$1
21..
22.de Ve \" End verbatim text
23.ft R
24.fi
25..
26.\" Set up some character translations and predefined strings. \*(-- will
27.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
28.\" double quote, and \*(R" will give a right double quote. | will give a
29.\" real vertical bar. \*(C+ will give a nicer C++. Capital omega is used to
30.\" do unbreakable dashes and therefore won't be available. \*(C` and \*(C'
31.\" expand to `' in nroff, nothing in troff, for use with C<>.
32.tr \(*W-|\(bv\*(Tr
33.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
34.ie n \{\
35. ds -- \(*W-
36. ds PI pi
37. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
38. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
39. ds L" ""
40. ds R" ""
41. ds C` ""
42. ds C' ""
43'br\}
44.el\{\
45. ds -- \|\(em\|
46. ds PI \(*p
47. ds L" ``
48. ds R" ''
49'br\}
50.\"
51.\" If the F register is turned on, we'll generate index entries on stderr for
52.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
53.\" entries marked with X<> in POD. Of course, you'll have to process the
54.\" output yourself in some meaningful fashion.
55.if \nF \{\
56. de IX
57. tm Index:\\$1\t\\n%\t"\\$2"
58..
59. nr % 0
60. rr F
61.\}
62.\"
63.\" For nroff, turn off justification. Always turn off hyphenation; it makes
64.\" way too many mistakes in technical documents.
65.hy 0
66.if n .na
67.\"
68.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
69.\" Fear. Run. Save yourself. No user-serviceable parts.
70. \" fudge factors for nroff and troff
71.if n \{\
72. ds #H 0
73. ds #V .8m
74. ds #F .3m
75. ds #[ \f1
76. ds #] \fP
77.\}
78.if t \{\
79. ds #H ((1u-(\\\\n(.fu%2u))*.13m)
80. ds #V .6m
81. ds #F 0
82. ds #[ \&
83. ds #] \&
84.\}
85. \" simple accents for nroff and troff
86.if n \{\
87. ds ' \&
88. ds ` \&
89. ds ^ \&
90. ds , \&
91. ds ~ ~
92. ds /
93.\}
94.if t \{\
95. ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
96. ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
97. ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
98. ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
99. ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
100. ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
101.\}
102. \" troff and (daisy-wheel) nroff accents
103.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
104.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
105.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
106.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
107.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
108.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
109.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
110.ds ae a\h'-(\w'a'u*4/10)'e
111.ds Ae A\h'-(\w'A'u*4/10)'E
112. \" corrections for vroff
113.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
114.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
115. \" for low resolution devices (crt and lpr)
116.if \n(.H>23 .if \n(.V>19 \
117\{\
118. ds : e
119. ds 8 ss
120. ds o a
121. ds d- d\h'-1'\(ga
122. ds D- D\h'-1'\(hy
123. ds th \o'bp'
124. ds Th \o'LP'
125. ds ae ae
126. ds Ae AE
127.\}
128.rm #[ #] #H #V #F C
129.\" ========================================================================
130.\"
131.IX Title "PERLPODSPEC 1"
132.TH PERLPODSPEC 1 "2002-06-08" "perl v5.8.0" "Perl Programmers Reference Guide"
133.SH "NAME"
134perlpodspec \- Plain Old Documentation: format specification and notes
135.SH "DESCRIPTION"
136.IX Header "DESCRIPTION"
137This document is detailed notes on the Pod markup language. Most
138people will only have to read perlpod to know how to write
139in Pod, but this document may answer some incidental questions to do
140with parsing and rendering Pod.
141.PP
142In this document, \*(L"must\*(R" / \*(L"must not\*(R", \*(L"should\*(R" /
143\&\*(L"should not\*(R", and \*(L"may\*(R" have their conventional (cf. \s-1RFC\s0 2119)
144meanings: \*(L"X must do Y\*(R" means that if X doesn't do Y, it's against
145this specification, and should really be fixed. \*(L"X should do Y\*(R"
146means that it's recommended, but X may fail to do Y, if there's a
147good reason. \*(L"X may do Y\*(R" is merely a note that X can do Y at
148will (although it is up to the reader to detect any connotation of
149"and I think it would be \fInice\fR if X did Y\*(L" versus \*(R"it wouldn't
150really \fIbother\fR me if X did Y").
151.PP
152Notably, when I say \*(L"the parser should do Y\*(R", the
153parser may fail to do Y, if the calling application explicitly
154requests that the parser \fInot\fR do Y. I often phrase this as
155\&\*(L"the parser should, by default, do Y.\*(R" This doesn't \fIrequire\fR
156the parser to provide an option for turning off whatever
157feature Y is (like expanding tabs in verbatim paragraphs), although
158it implicates that such an option \fImay\fR be provided.
159.SH "Pod Definitions"
160.IX Header "Pod Definitions"
161Pod is embedded in files, typically Perl source files \*(-- although you
162can write a file that's nothing but Pod.
163.PP
164A \fBline\fR in a file consists of zero or more non-newline characters,
165terminated by either a newline or the end of the file.
166.PP
167A \fBnewline sequence\fR is usually a platform-dependent concept, but
168Pod parsers should understand it to mean any of \s-1CR\s0 (\s-1ASCII\s0 13), \s-1LF\s0
169(\s-1ASCII\s0 10), or a \s-1CRLF\s0 (\s-1ASCII\s0 13 followed immediately by \s-1ASCII\s0 10), in
170addition to any other system-specific meaning. The first \s-1CR/CRLF/LF\s0
171sequence in the file may be used as the basis for identifying the
172newline sequence for parsing the rest of the file.
173.PP
174A \fBblank line\fR is a line consisting entirely of zero or more spaces
175(\s-1ASCII\s0 32) or tabs (\s-1ASCII\s0 9), and terminated by a newline or end\-of\-file.
176A \fBnon-blank line\fR is a line containing one or more characters other
177than space or tab (and terminated by a newline or end\-of\-file).
178.PP
179(\fINote:\fR Many older Pod parsers did not accept a line consisting of
180spaces/tabs and then a newline as a blank line \*(-- the only lines they
181considered blank were lines consisting of \fIno characters at all\fR,
182terminated by a newline.)
183.PP
184\&\fBWhitespace\fR is used in this document as a blanket term for spaces,
185tabs, and newline sequences. (By itself, this term usually refers
186to literal whitespace. That is, sequences of whitespace characters
187in Pod source, as opposed to "E<32>", which is a formatting
188code that \fIdenotes\fR a whitespace character.)
189.PP
190A \fBPod parser\fR is a module meant for parsing Pod (regardless of
191whether this involves calling callbacks or building a parse tree or
192directly formatting it). A \fBPod formatter\fR (or \fBPod translator\fR)
193is a module or program that converts Pod to some other format (\s-1HTML\s0,
194plaintext, TeX, PostScript, \s-1RTF\s0). A \fBPod processor\fR might be a
195formatter or translator, or might be a program that does something
196else with the Pod (like wordcounting it, scanning for index points,
197etc.).
198.PP
199Pod content is contained in \fBPod blocks\fR. A Pod block starts with a
200line that matches <m/\eA=[a\-zA\-Z]/>, and continues up to the next line
201that matches \f(CW\*(C`m/\eA=cut/\*(C'\fR \*(-- or up to the end of the file, if there is
202no \f(CW\*(C`m/\eA=cut/\*(C'\fR line.
203.PP
204Within a Pod block, there are \fBPod paragraphs\fR. A Pod paragraph
205consists of non-blank lines of text, separated by one or more blank
206lines.
207.PP
208For purposes of Pod processing, there are four types of paragraphs in
209a Pod block:
210.IP "\(bu" 4
211A command paragraph (also called a \*(L"directive\*(R"). The first line of
212this paragraph must match \f(CW\*(C`m/\eA=[a\-zA\-Z]/\*(C'\fR. Command paragraphs are
213typically one line, as in:
214.Sp
215.Vb 1
216\& =head1 NOTES
217.Ve
218.Sp
219.Vb 1
220\& =item *
221.Ve
222.Sp
223But they may span several (non\-blank) lines:
224.Sp
225.Vb 3
226\& =for comment
227\& Hm, I wonder what it would look like if
228\& you tried to write a BNF for Pod from this.
229.Ve
230.Sp
231.Vb 2
232\& =head3 Dr. Strangelove, or: How I Learned to
233\& Stop Worrying and Love the Bomb
234.Ve
235.Sp
236\&\fISome\fR command paragraphs allow formatting codes in their content
237(i.e., after the part that matches \f(CW\*(C`m/\eA=[a\-zA\-Z]\eS*\es*/\*(C'\fR), as in:
238.Sp
239.Vb 1
240\& =head1 Did You Remember to C<use strict;>?
241.Ve
242.Sp
243In other words, the Pod processing handler for \*(L"head1\*(R" will apply the
244same processing to "Did You Remember to C<use strict;>?\*(L" that it
245would to an ordinary paragraph \*(-- i.e., formatting codes (like
246\&\*(R"C<...>") are parsed and presumably formatted appropriately, and
247whitespace in the form of literal spaces and/or tabs is not
248significant.
249.IP "\(bu" 4
250A \fBverbatim paragraph\fR. The first line of this paragraph must be a
251literal space or tab, and this paragraph must not be inside a "=begin
252\&\fIidentifier\fR\*(L", ... \*(R"=end \fIidentifier\fR\*(L" sequence unless
253\&\*(R"\fIidentifier\fR\*(L" begins with a colon (\*(R":"). That is, if a paragraph
254starts with a literal space or tab, but \fIis\fR inside a
255"=begin \fIidentifier\fR\*(L", ... \*(R"=end \fIidentifier\fR\*(L" region, then it's
256a data paragraph, unless \*(R"\fIidentifier\fR" begins with a colon.
257.Sp
258Whitespace \fIis\fR significant in verbatim paragraphs (although, in
259processing, tabs are probably expanded).
260.IP "\(bu" 4
261An \fBordinary paragraph\fR. A paragraph is an ordinary paragraph
262if its first line matches neither \f(CW\*(C`m/\eA=[a\-zA\-Z]/\*(C'\fR nor
263\&\f(CW\*(C`m/\eA[ \et]/\*(C'\fR, \fIand\fR if it's not inside a "=begin \fIidentifier\fR\*(L",
264\&... \*(R"=end \fIidentifier\fR\*(L" sequence unless \*(R"\fIidentifier\fR\*(L" begins with
265a colon (\*(R":").
266.IP "\(bu" 4
267A \fBdata paragraph\fR. This is a paragraph that \fIis\fR inside a "=begin
268\&\fIidentifier\fR\*(L" ... \*(R"=end \fIidentifier\fR\*(L" sequence where
269\&\*(R"\fIidentifier\fR" does \fInot\fR begin with a literal colon (\*(L":\*(R"). In
270some sense, a data paragraph is not part of Pod at all (i.e.,
271effectively it's \*(L"out\-of\-band\*(R"), since it's not subject to most kinds
272of Pod parsing; but it is specified here, since Pod
273parsers need to be able to call an event for it, or store it in some
274form in a parse tree, or at least just parse \fIaround\fR it.
275.PP
276For example: consider the following paragraphs:
277.PP
278.Vb 1
279\& # <- that's the 0th column
280.Ve
281.PP
282.Vb 1
283\& =head1 Foo
284.Ve
285.PP
286.Vb 1
287\& Stuff
288.Ve
289.PP
290.Vb 1
291\& $foo->bar
292.Ve
293.PP
294.Vb 1
295\& =cut
296.Ve
297.PP
298Here, \*(L"=head1 Foo\*(R" and \*(L"=cut\*(R" are command paragraphs because the first
299line of each matches \f(CW\*(C`m/\eA=[a\-zA\-Z]/\*(C'\fR. "\fI[space][space]\fR$foo\->bar\*(L"
300is a verbatim paragraph, because its first line starts with a literal
301whitespace character (and there's no \*(R"=begin\*(L"...\*(R"=end" region around).
302.PP
303The "=begin \fIidentifier\fR\*(L" ... \*(R"=end \fIidentifier\fR" commands stop
304paragraphs that they surround from being parsed as data or verbatim
305paragraphs, if \fIidentifier\fR doesn't begin with a colon. This
306is discussed in detail in the section
307\&\*(L"About Data Paragraphs and \*(R"=begin/=end\*(L" Regions\*(R".
308.SH "Pod Commands"
309.IX Header "Pod Commands"
310This section is intended to supplement and clarify the discussion in
311\&\*(L"Command Paragraph\*(R" in perlpod. These are the currently recognized
312Pod commands:
313.ie n .IP """=head1"", ""=head2"", ""=head3"", ""=head4""" 4
314.el .IP "``=head1'', ``=head2'', ``=head3'', ``=head4''" 4
315.IX Item "=head1, =head2, =head3, =head4"
316This command indicates that the text in the remainder of the paragraph
317is a heading. That text may contain formatting codes. Examples:
318.Sp
319.Vb 1
320\& =head1 Object Attributes
321.Ve
322.Sp
323.Vb 1
324\& =head3 What B<Not> to Do!
325.Ve
326.ie n .IP """=pod""" 4
327.el .IP "``=pod''" 4
328.IX Item "=pod"
329This command indicates that this paragraph begins a Pod block. (If we
330are already in the middle of a Pod block, this command has no effect at
331all.) If there is any text in this command paragraph after \*(L"=pod\*(R",
332it must be ignored. Examples:
333.Sp
334.Vb 1
335\& =pod
336.Ve
337.Sp
338.Vb 1
339\& This is a plain Pod paragraph.
340.Ve
341.Sp
342.Vb 1
343\& =pod This text is ignored.
344.Ve
345.ie n .IP """=cut""" 4
346.el .IP "``=cut''" 4
347.IX Item "=cut"
348This command indicates that this line is the end of this previously
349started Pod block. If there is any text after \*(L"=cut\*(R" on the line, it must be
350ignored. Examples:
351.Sp
352.Vb 1
353\& =cut
354.Ve
355.Sp
356.Vb 1
357\& =cut The documentation ends here.
358.Ve
359.Sp
360.Vb 3
361\& =cut
362\& # This is the first line of program text.
363\& sub foo { # This is the second.
364.Ve
365.Sp
366It is an error to try to \fIstart\fR a Pod black with a \*(L"=cut\*(R" command. In
367that case, the Pod processor must halt parsing of the input file, and
368must by default emit a warning.
369.ie n .IP """=over""" 4
370.el .IP "``=over''" 4
371.IX Item "=over"
372This command indicates that this is the start of a list/indent
373region. If there is any text following the \*(L"=over\*(R", it must consist
374of only a nonzero positive numeral. The semantics of this numeral is
375explained in the \*(L"About =over...=back Regions\*(R" section, further
376below. Formatting codes are not expanded. Examples:
377.Sp
378.Vb 1
379\& =over 3
380.Ve
381.Sp
382.Vb 1
383\& =over 3.5
384.Ve
385.Sp
386.Vb 1
387\& =over
388.Ve
389.ie n .IP """=item""" 4
390.el .IP "``=item''" 4
391.IX Item "=item"
392This command indicates that an item in a list begins here. Formatting
393codes are processed. The semantics of the (optional) text in the
394remainder of this paragraph are
395explained in the \*(L"About =over...=back Regions\*(R" section, further
396below. Examples:
397.Sp
398.Vb 1
399\& =item
400.Ve
401.Sp
402.Vb 1
403\& =item *
404.Ve
405.Sp
406.Vb 1
407\& =item *
408.Ve
409.Sp
410.Vb 1
411\& =item 14
412.Ve
413.Sp
414.Vb 1
415\& =item 3.
416.Ve
417.Sp
418.Vb 1
419\& =item C<< $thing->stuff(I<dodad>) >>
420.Ve
421.Sp
422.Vb 2
423\& =item For transporting us beyond seas to be tried for pretended
424\& offenses
425.Ve
426.Sp
427.Vb 5
428\& =item He is at this time transporting large armies of foreign
429\& mercenaries to complete the works of death, desolation and
430\& tyranny, already begun with circumstances of cruelty and perfidy
431\& scarcely paralleled in the most barbarous ages, and totally
432\& unworthy the head of a civilized nation.
433.Ve
434.ie n .IP """=back""" 4
435.el .IP "``=back''" 4
436.IX Item "=back"
437This command indicates that this is the end of the region begun
438by the most recent \*(L"=over\*(R" command. It permits no text after the
439\&\*(L"=back\*(R" command.
440.ie n .IP """=begin formatname""" 4
441.el .IP "``=begin formatname''" 4
442.IX Item "=begin formatname"
443This marks the following paragraphs (until the matching \*(L"=end
444formatname\*(R") as being for some special kind of processing. Unless
445\&\*(L"formatname\*(R" begins with a colon, the contained non-command
446paragraphs are data paragraphs. But if \*(L"formatname\*(R" \fIdoes\fR begin
447with a colon, then non-command paragraphs are ordinary paragraphs
448or data paragraphs. This is discussed in detail in the section
449\&\*(L"About Data Paragraphs and \*(R"=begin/=end\*(L" Regions\*(R".
450.Sp
451It is advised that formatnames match the regexp
452\&\f(CW\*(C`m/\eA:?[\-a\-zA\-Z0\-9_]+\ez/\*(C'\fR. Implementors should anticipate future
453expansion in the semantics and syntax of the first parameter
454to \*(L"=begin\*(R"/\*(L"=end\*(R"/\*(L"=for\*(R".
455.ie n .IP """=end formatname""" 4
456.el .IP "``=end formatname''" 4
457.IX Item "=end formatname"
458This marks the end of the region opened by the matching
459\&\*(L"=begin formatname\*(R" region. If \*(L"formatname\*(R" is not the formatname
460of the most recent open \*(L"=begin formatname\*(R" region, then this
461is an error, and must generate an error message. This
462is discussed in detail in the section
463\&\*(L"About Data Paragraphs and \*(R"=begin/=end\*(L" Regions\*(R".
464.ie n .IP """=for formatname text...""" 4
465.el .IP "``=for formatname text...''" 4
466.IX Item "=for formatname text..."
467This is synonymous with:
468.Sp
469.Vb 1
470\& =begin formatname
471.Ve
472.Sp
473.Vb 1
474\& text...
475.Ve
476.Sp
477.Vb 1
478\& =end formatname
479.Ve
480.Sp
481That is, it creates a region consisting of a single paragraph; that
482paragraph is to be treated as a normal paragraph if \*(L"formatname\*(R"
483begins with a \*(L":\*(R"; if \*(L"formatname\*(R" \fIdoesn't\fR begin with a colon,
484then \*(L"text...\*(R" will constitute a data paragraph. There is no way
485to use \*(L"=for formatname text...\*(R" to express \*(L"text...\*(R" as a verbatim
486paragraph.
487.PP
488If a Pod processor sees any command other than the ones listed
489above (like \*(L"=head\*(R", or \*(L"=haed1\*(R", or \*(L"=stuff\*(R", or \*(L"=cuttlefish\*(R",
490or \*(L"=w123\*(R"), that processor must by default treat this as an
491error. It must not process the paragraph beginning with that
492command, must by default warn of this as an error, and may
493abort the parse. A Pod parser may allow a way for particular
494applications to add to the above list of known commands, and to
495stipulate, for each additional command, whether formatting
496codes should be processed.
497.PP
498Future versions of this specification may add additional
499commands.
500.SH "Pod Formatting Codes"
501.IX Header "Pod Formatting Codes"
502(Note that in previous drafts of this document and of perlpod,
503formatting codes were referred to as \*(L"interior sequences\*(R", and
504this term may still be found in the documentation for Pod parsers,
505and in error messages from Pod processors.)
506.PP
507There are two syntaxes for formatting codes:
508.IP "\(bu" 4
509A formatting code starts with a capital letter (just US-ASCII [A\-Z])
510followed by a \*(L"<\*(R", any number of characters, and ending with the first
511matching \*(L">\*(R". Examples:
512.Sp
513.Vb 1
514\& That's what I<you> think!
515.Ve
516.Sp
517.Vb 1
518\& What's C<dump()> for?
519.Ve
520.Sp
521.Vb 1
522\& X<C<chmod> and C<unlink()> Under Different Operating Systems>
523.Ve
524.IP "\(bu" 4
525A formatting code starts with a capital letter (just US-ASCII [A\-Z])
526followed by two or more \*(L"<\*(R"'s, one or more whitespace characters,
527any number of characters, one or more whitespace characters,
528and ending with the first matching sequence of two or more \*(L">\*(R"'s, where
529the number of \*(L">\*(R"'s equals the number of \*(L"<\*(R"'s in the opening of this
530formatting code. Examples:
531.Sp
532.Vb 1
533\& That's what I<< you >> think!
534.Ve
535.Sp
536.Vb 1
537\& C<<< open(X, ">>thing.dat") || die $! >>>
538.Ve
539.Sp
540.Vb 1
541\& B<< $foo->bar(); >>
542.Ve
543.Sp
544With this syntax, the whitespace character(s) after the "C<<<\*(L"
545and before the \*(R">>" (or whatever letter) are \fInot\fR renderable \*(-- they
546do not signify whitespace, are merely part of the formatting codes
547themselves. That is, these are all synonymous:
548.Sp
549.Vb 7
550\& C<thing>
551\& C<< thing >>
552\& C<< thing >>
553\& C<<< thing >>>
554\& C<<<<
555\& thing
556\& >>>>
557.Ve
558.Sp
559and so on.
560.PP
561In parsing Pod, a notably tricky part is the correct parsing of
562(potentially nested!) formatting codes. Implementors should
563consult the code in the \f(CW\*(C`parse_text\*(C'\fR routine in Pod::Parser as an
564example of a correct implementation.
565.ie n .IP """I<text>"" \*(-- italic text" 4
566.el .IP "\f(CWI<text>\fR \*(-- italic text" 4
567.IX Item "I<text> italic text"
568See the brief discussion in \*(L"Formatting Codes\*(R" in perlpod.
569.ie n .IP """B<text>"" \*(-- bold text" 4
570.el .IP "\f(CWB<text>\fR \*(-- bold text" 4
571.IX Item "B<text> bold text"
572See the brief discussion in \*(L"Formatting Codes\*(R" in perlpod.
573.ie n .IP """C<code>"" \*(-- code text" 4
574.el .IP "\f(CWC<code>\fR \*(-- code text" 4
575.IX Item "C<code> code text"
576See the brief discussion in \*(L"Formatting Codes\*(R" in perlpod.
577.ie n .IP """F<filename>"" \*(-- style for filenames" 4
578.el .IP "\f(CWF<filename>\fR \*(-- style for filenames" 4
579.IX Item "F<filename> style for filenames"
580See the brief discussion in \*(L"Formatting Codes\*(R" in perlpod.
581.ie n .IP """X<topic name>"" \*(-- an index entry" 4
582.el .IP "\f(CWX<topic name>\fR \*(-- an index entry" 4
583.IX Item "X<topic name> an index entry"
584See the brief discussion in \*(L"Formatting Codes\*(R" in perlpod.
585.Sp
586This code is unusual in that most formatters completely discard
587this code and its content. Other formatters will render it with
588invisible codes that can be used in building an index of
589the current document.
590.ie n .IP """Z<>"" \*(-- a null (zero\-effect) formatting code" 4
591.el .IP "\f(CWZ<>\fR \*(-- a null (zero\-effect) formatting code" 4
592.IX Item "Z<> a null (zero-effect) formatting code"
593Discussed briefly in \*(L"Formatting Codes\*(R" in perlpod.
594.Sp
595This code is unusual is that it should have no content. That is,
596a processor may complain if it sees \f(CW\*(C`Z<potatoes>\*(C'\fR. Whether
597or not it complains, the \fIpotatoes\fR text should ignored.
598.ie n .IP """L<name>"" \*(-- a hyperlink" 4
599.el .IP "\f(CWL<name>\fR \*(-- a hyperlink" 4
600.IX Item "L<name> a hyperlink"
601The complicated syntaxes of this code are discussed at length in
602\&\*(L"Formatting Codes\*(R" in perlpod, and implementation details are
603discussed below, in "About L<...> Codes". Parsing the
604contents of L<content> is tricky. Notably, the content has to be
605checked for whether it looks like a \s-1URL\s0, or whether it has to be split
606on literal \*(L"|\*(R" and/or \*(L"/\*(R" (in the right order!), and so on,
607\&\fIbefore\fR E<...> codes are resolved.
608.ie n .IP """E<escape>"" \*(-- a character escape" 4
609.el .IP "\f(CWE<escape>\fR \*(-- a character escape" 4
610.IX Item "E<escape> a character escape"
611See \*(L"Formatting Codes\*(R" in perlpod, and several points in
612\&\*(L"Notes on Implementing Pod Processors\*(R".
613.ie n .IP """S<text>"" \*(-- text contains non-breaking spaces" 4
614.el .IP "\f(CWS<text>\fR \*(-- text contains non-breaking spaces" 4
615.IX Item "S<text> text contains non-breaking spaces"
616This formatting code is syntactically simple, but semantically
617complex. What it means is that each space in the printable
618content of this code signifies a nonbreaking space.
619.Sp
620Consider:
621.Sp
622.Vb 1
623\& C<$x ? $y : $z>
624.Ve
625.Sp
626.Vb 1
627\& S<C<$x ? $y : $z>>
628.Ve
629.Sp
630Both signify the monospace (c[ode] style) text consisting of
631\&\*(L"$x\*(R", one space, \*(L"?\*(R", one space, \*(L":\*(R", one space, \*(L"$z\*(R". The
632difference is that in the latter, with the S code, those spaces
633are not \*(L"normal\*(R" spaces, but instead are nonbreaking spaces.
634.PP
635If a Pod processor sees any formatting code other than the ones
636listed above (as in "N<...>\*(L", or \*(R"Q<...>", etc.), that
637processor must by default treat this as an error.
638A Pod parser may allow a way for particular
639applications to add to the above list of known formatting codes;
640a Pod parser might even allow a way to stipulate, for each additional
641command, whether it requires some form of special processing, as
642L<...> does.
643.PP
644Future versions of this specification may add additional
645formatting codes.
646.PP
647Historical note: A few older Pod processors would not see a \*(L">\*(R" as
648closing a "C<\*(L" code, if the \*(R">\*(L" was immediately preceded by
649a \*(R"\-". This was so that this:
650.PP
651.Vb 1
652\& C<$foo->bar>
653.Ve
654.PP
655would parse as equivalent to this:
656.PP
657.Vb 1
658\& C<$foo-E<lt>bar>
659.Ve
660.PP
661instead of as equivalent to a \*(L"C\*(R" formatting code containing
662only \*(L"$foo\-\*(R", and then a \*(L"bar>\*(R" outside the \*(L"C\*(R" formatting code. This
663problem has since been solved by the addition of syntaxes like this:
664.PP
665.Vb 1
666\& C<< $foo->bar >>
667.Ve
668.PP
669Compliant parsers must not treat \*(L"\->\*(R" as special.
670.PP
671Formatting codes absolutely cannot span paragraphs. If a code is
672opened in one paragraph, and no closing code is found by the end of
673that paragraph, the Pod parser must close that formatting code,
674and should complain (as in \*(L"Unterminated I code in the paragraph
675starting at line 123: 'Time objects are not...'\*(R"). So these
676two paragraphs:
677.PP
678.Vb 1
679\& I<I told you not to do this!
680.Ve
681.PP
682.Vb 1
683\& Don't make me say it again!>
684.Ve
685.PP
686\&...must \fInot\fR be parsed as two paragraphs in italics (with the I
687code starting in one paragraph and starting in another.) Instead,
688the first paragraph should generate a warning, but that aside, the
689above code must parse as if it were:
690.PP
691.Vb 1
692\& I<I told you not to do this!>
693.Ve
694.PP
695.Vb 1
696\& Don't make me say it again!E<gt>
697.Ve
698.PP
699(In SGMLish jargon, all Pod commands are like block-level
700elements, whereas all Pod formatting codes are like inline-level
701elements.)
702.SH "Notes on Implementing Pod Processors"
703.IX Header "Notes on Implementing Pod Processors"
704The following is a long section of miscellaneous requirements
705and suggestions to do with Pod processing.
706.IP "\(bu" 4
707Pod formatters should tolerate lines in verbatim blocks that are of
708any length, even if that means having to break them (possibly several
709times, for very long lines) to avoid text running off the side of the
710page. Pod formatters may warn of such line\-breaking. Such warnings
711are particularly appropriate for lines are over 100 characters long, which
712are usually not intentional.
713.IP "\(bu" 4
714Pod parsers must recognize \fIall\fR of the three well-known newline
715formats: \s-1CR\s0, \s-1LF\s0, and \s-1CRLF\s0. See perlport.
716.IP "\(bu" 4
717Pod parsers should accept input lines that are of any length.
718.IP "\(bu" 4
719Since Perl recognizes a Unicode Byte Order Mark at the start of files
720as signaling that the file is Unicode encoded as in \s-1UTF\-16\s0 (whether
721big-endian or little\-endian) or \s-1UTF\-8\s0, Pod parsers should do the
722same. Otherwise, the character encoding should be understood as
723being \s-1UTF\-8\s0 if the first highbit byte sequence in the file seems
724valid as a \s-1UTF\-8\s0 sequence, or otherwise as Latin\-1.
725.Sp
726Future versions of this specification may specify
727how Pod can accept other encodings. Presumably treatment of other
728encodings in Pod parsing would be as in \s-1XML\s0 parsing: whatever the
729encoding declared by a particular Pod file, content is to be
730stored in memory as Unicode characters.
731.IP "\(bu" 4
732The well known Unicode Byte Order Marks are as follows: if the
733file begins with the two literal byte values 0xFE 0xFF, this is
734the \s-1BOM\s0 for big-endian \s-1UTF\-16\s0. If the file begins with the two
735literal byte value 0xFF 0xFE, this is the \s-1BOM\s0 for little-endian
736\&\s-1UTF\-16\s0. If the file begins with the three literal byte values
7370xEF 0xBB 0xBF, this is the \s-1BOM\s0 for \s-1UTF\-8\s0.
738.IP "\(bu" 4
739A naive but sufficient heuristic for testing the first highbit
740byte-sequence in a BOM-less file (whether in code or in Pod!), to see
741whether that sequence is valid as \s-1UTF\-8\s0 (\s-1RFC\s0 2279) is to check whether
742that the first byte in the sequence is in the range 0xC0 \- 0xFD
743\&\fIand\fR whether the next byte is in the range
7440x80 \- 0xBF. If so, the parser may conclude that this file is in
745\&\s-1UTF\-8\s0, and all highbit sequences in the file should be assumed to
746be \s-1UTF\-8\s0. Otherwise the parser should treat the file as being
747in Latin\-1. In the unlikely circumstance that the first highbit
748sequence in a truly non\-UTF\-8 file happens to appear to be \s-1UTF\-8\s0, one
749can cater to our heuristic (as well as any more intelligent heuristic)
750by prefacing that line with a comment line containing a highbit
751sequence that is clearly \fInot\fR valid as \s-1UTF\-8\s0. A line consisting
752of simply \*(L"#\*(R", an e\-acute, and any non-highbit byte,
753is sufficient to establish this file's encoding.
754.IP "\(bu" 4
755This document's requirements and suggestions about encodings
756do not apply to Pod processors running on non-ASCII platforms,
757notably \s-1EBCDIC\s0 platforms.
758.IP "\(bu" 4
759Pod processors must treat a \*(L"=for [label] [content...]\*(R" paragraph as
760meaning the same thing as a \*(L"=begin [label]\*(R" paragraph, content, and
761an \*(L"=end [label]\*(R" paragraph. (The parser may conflate these two
762constructs, or may leave them distinct, in the expectation that the
763formatter will nevertheless treat them the same.)
764.IP "\(bu" 4
765When rendering Pod to a format that allows comments (i.e., to nearly
766any format other than plaintext), a Pod formatter must insert comment
767text identifying its name and version number, and the name and
768version numbers of any modules it might be using to process the Pod.
769Minimal examples:
770.Sp
771.Vb 1
772\& %% POD::Pod2PS v3.14159, using POD::Parser v1.92
773.Ve
774.Sp
775.Vb 1
776\& <!-- Pod::HTML v3.14159, using POD::Parser v1.92 -->
777.Ve
778.Sp
779.Vb 1
780\& {\edoccomm generated by Pod::Tree::RTF 3.14159 using Pod::Tree 1.08}
781.Ve
782.Sp
783.Vb 1
784\& .\e" Pod::Man version 3.14159, using POD::Parser version 1.92
785.Ve
786.Sp
787Formatters may also insert additional comments, including: the
788release date of the Pod formatter program, the contact address for
789the author(s) of the formatter, the current time, the name of input
790file, the formatting options in effect, version of Perl used, etc.
791.Sp
792Formatters may also choose to note errors/warnings as comments,
793besides or instead of emitting them otherwise (as in messages to
794\&\s-1STDERR\s0, or \f(CW\*(C`die\*(C'\fRing).
795.IP "\(bu" 4
796Pod parsers \fImay\fR emit warnings or error messages ("Unknown E code
797E<zslig>!") to \s-1STDERR\s0 (whether through printing to \s-1STDERR\s0, or
798\&\f(CW\*(C`warn\*(C'\fRing/\f(CW\*(C`carp\*(C'\fRing, or \f(CW\*(C`die\*(C'\fRing/\f(CW\*(C`croak\*(C'\fRing), but \fImust\fR allow
799suppressing all such \s-1STDERR\s0 output, and instead allow an option for
800reporting errors/warnings
801in some other way, whether by triggering a callback, or noting errors
802in some attribute of the document object, or some similarly unobtrusive
803mechanism \*(-- or even by appending a \*(L"Pod Errors\*(R" section to the end of
804the parsed form of the document.
805.IP "\(bu" 4
806In cases of exceptionally aberrant documents, Pod parsers may abort the
807parse. Even then, using \f(CW\*(C`die\*(C'\fRing/\f(CW\*(C`croak\*(C'\fRing is to be avoided; where
808possible, the parser library may simply close the input file
809and add text like \*(L"*** Formatting Aborted ***\*(R" to the end of the
810(partial) in-memory document.
811.IP "\(bu" 4
812In paragraphs where formatting codes (like E<...>, B<...>)
813are understood (i.e., \fInot\fR verbatim paragraphs, but \fIincluding\fR
814ordinary paragraphs, and command paragraphs that produce renderable
815text, like \*(L"=head1\*(R"), literal whitespace should generally be considered
816\&\*(L"insignificant\*(R", in that one literal space has the same meaning as any
817(nonzero) number of literal spaces, literal newlines, and literal tabs
818(as long as this produces no blank lines, since those would terminate
819the paragraph). Pod parsers should compact literal whitespace in each
820processed paragraph, but may provide an option for overriding this
821(since some processing tasks do not require it), or may follow
822additional special rules (for example, specially treating
823period-space-space or period-newline sequences).
824.IP "\(bu" 4
825Pod parsers should not, by default, try to coerce apostrophe (') and
826quote (\*(L") into smart quotes (little 9's, 66's, 99's, etc), nor try to
827turn backtick (`) into anything else but a single backtick character
828(distinct from an openquote character!), nor \*(R"\-\-" into anything but
829two minus signs. They \fImust never\fR do any of those things to text
830in C<...> formatting codes, and never \fIever\fR to text in verbatim
831paragraphs.
832.IP "\(bu" 4
833When rendering Pod to a format that has two kinds of hyphens (\-), one
834that's a nonbreaking hyphen, and another that's a breakable hyphen
835(as in \*(L"object\-oriented\*(R", which can be split across lines as
836\&\*(L"object\-\*(R", newline, \*(L"oriented\*(R"), formatters are encouraged to
837generally translate \*(L"\-\*(R" to nonbreaking hyphen, but may apply
838heuristics to convert some of these to breaking hyphens.
839.IP "\(bu" 4
840Pod formatters should make reasonable efforts to keep words of Perl
841code from being broken across lines. For example, \*(L"Foo::Bar\*(R" in some
842formatting systems is seen as eligible for being broken across lines
843as \*(L"Foo::\*(R" newline \*(L"Bar\*(R" or even \*(L"Foo::\-\*(R" newline \*(L"Bar\*(R". This should
844be avoided where possible, either by disabling all line-breaking in
845mid\-word, or by wrapping particular words with internal punctuation
846in \*(L"don't break this across lines\*(R" codes (which in some formats may
847not be a single code, but might be a matter of inserting non-breaking
848zero-width spaces between every pair of characters in a word.)
849.IP "\(bu" 4
850Pod parsers should, by default, expand tabs in verbatim paragraphs as
851they are processed, before passing them to the formatter or other
852processor. Parsers may also allow an option for overriding this.
853.IP "\(bu" 4
854Pod parsers should, by default, remove newlines from the end of
855ordinary and verbatim paragraphs before passing them to the
856formatter. For example, while the paragraph you're reading now
857could be considered, in Pod source, to end with (and contain)
858the newline(s) that end it, it should be processed as ending with
859(and containing) the period character that ends this sentence.
860.IP "\(bu" 4
861Pod parsers, when reporting errors, should make some effort to report
862an approximate line number ("Nested E<>'s in Paragraph #52, near
863line 633 of Thing/Foo.pm!\*(L"), instead of merely noting the paragraph
864number (\*(R"Nested E<>'s in Paragraph #52 of Thing/Foo.pm!\*(L"). Where
865this is problematic, the paragraph number should at least be
866accompanied by an excerpt from the paragraph (\*(R"Nested E<>'s in
867Paragraph #52 of Thing/Foo.pm, which begins 'Read/write accessor for
868the C<interest rate> attribute...'").
869.IP "\(bu" 4
870Pod parsers, when processing a series of verbatim paragraphs one
871after another, should consider them to be one large verbatim
872paragraph that happens to contain blank lines. I.e., these two
873lines, which have a blank line between them:
874.Sp
875.Vb 1
876\& use Foo;
877.Ve
878.Sp
879.Vb 1
880\& print Foo->VERSION
881.Ve
882.Sp
883should be unified into one paragraph (\*(L"\etuse Foo;\en\en\etprint
884Foo\->\s-1VERSION\s0\*(R") before being passed to the formatter or other
885processor. Parsers may also allow an option for overriding this.
886.Sp
887While this might be too cumbersome to implement in event-based Pod
888parsers, it is straightforward for parsers that return parse trees.
889.IP "\(bu" 4
890Pod formatters, where feasible, are advised to avoid splitting short
891verbatim paragraphs (under twelve lines, say) across pages.
892.IP "\(bu" 4
893Pod parsers must treat a line with only spaces and/or tabs on it as a
894\&\*(L"blank line\*(R" such as separates paragraphs. (Some older parsers
895recognized only two adjacent newlines as a \*(L"blank line\*(R" but would not
896recognize a newline, a space, and a newline, as a blank line. This
897is noncompliant behavior.)
898.IP "\(bu" 4
899Authors of Pod formatters/processors should make every effort to
900avoid writing their own Pod parser. There are already several in
901\&\s-1CPAN\s0, with a wide range of interface styles \*(-- and one of them,
902Pod::Parser, comes with modern versions of Perl.
903.IP "\(bu" 4
904Characters in Pod documents may be conveyed either as literals, or by
905number in E<n> codes, or by an equivalent mnemonic, as in
906E<eacute> which is exactly equivalent to E<233>.
907.Sp
908Characters in the range 32\-126 refer to those well known US-ASCII
909characters (also defined there by Unicode, with the same meaning),
910which all Pod formatters must render faithfully. Characters
911in the ranges 0\-31 and 127\-159 should not be used (neither as
912literals, nor as E<number> codes), except for the
913literal byte-sequences for newline (13, 13 10, or 10), and tab (9).
914.Sp
915Characters in the range 160\-255 refer to Latin\-1 characters (also
916defined there by Unicode, with the same meaning). Characters above
917255 should be understood to refer to Unicode characters.
918.IP "\(bu" 4
919Be warned
920that some formatters cannot reliably render characters outside 32\-126;
921and many are able to handle 32\-126 and 160\-255, but nothing above
922255.
923.IP "\(bu" 4
924Besides the well-known "E<lt>\*(L" and \*(R"E<gt>\*(L" codes for
925less-than and greater\-than, Pod parsers must understand \*(R"E<sol>\*(L"
926for \*(R"/\*(L" (solidus, slash), and \*(R"E<verbar>\*(L" for \*(R"|\*(L" (vertical bar,
927pipe). Pod parsers should also understand \*(R"E<lchevron>\*(L" and
928\&\*(R"E<rchevron>\*(L" as legacy codes for characters 171 and 187, i.e.,
929\&\*(R"left\-pointing double angle quotation mark\*(L" = \*(R"left pointing
930guillemet\*(L" and \*(R"right\-pointing double angle quotation mark\*(L" = \*(R"right
931pointing guillemet\*(L". (These look like little \*(R"<<\*(L" and \*(R">>\*(L", and they
932are now preferably expressed with the \s-1HTML/XHTML\s0 codes \*(R"E<laquo>\*(L"
933and \*(R"E<raquo>".)
934.IP "\(bu" 4
935Pod parsers should understand all "E<html>" codes as defined
936in the entity declarations in the most recent \s-1XHTML\s0 specification at
937\&\f(CW\*(C`www.W3.org\*(C'\fR. Pod parsers must understand at least the entities
938that define characters in the range 160\-255 (Latin\-1). Pod parsers,
939when faced with some unknown "E<\fIidentifier\fR>" code,
940shouldn't simply replace it with nullstring (by default, at least),
941but may pass it through as a string consisting of the literal characters
942E, less\-than, \fIidentifier\fR, greater\-than. Or Pod parsers may offer the
943alternative option of processing such unknown
944"E<\fIidentifier\fR>\*(L" codes by firing an event especially
945for such codes, or by adding a special node-type to the in-memory
946document tree. Such \*(R"E<\fIidentifier\fR>" may have special meaning
947to some processors, or some processors may choose to add them to
948a special error report.
949.IP "\(bu" 4
950Pod parsers must also support the \s-1XHTML\s0 codes "E<quot>\*(L" for
951character 34 (doublequote, \*(R"), "E<amp>\*(L" for character 38
952(ampersand, &), and \*(R"E<apos>" for character 39 (apostrophe, ').
953.IP "\(bu" 4
954Note that in all cases of "E<whatever>", \fIwhatever\fR (whether
955an htmlname, or a number in any base) must consist only of
956alphanumeric characters \*(-- that is, \fIwhatever\fR must watch
957\&\f(CW\*(C`m/\eA\ew+\ez/\*(C'\fR. So "E< 0 1 2 3 >" is invalid, because
958it contains spaces, which aren't alphanumeric characters. This
959presumably does not \fIneed\fR special treatment by a Pod processor;
960\&\*(L" 0 1 2 3 \*(R" doesn't look like a number in any base, so it would
961presumably be looked up in the table of HTML-like names. Since
962there isn't (and cannot be) an HTML-like entity called \*(L" 0 1 2 3 \*(R",
963this will be treated as an error. However, Pod processors may
964treat "E< 0 1 2 3 >\*(L" or \*(R"E<e\-acute>" as \fIsyntactically\fR
965invalid, potentially earning a different error message than the
966error message (or warning, or event) generated by a merely unknown
967(but theoretically valid) htmlname, as in "E<qacute>"
968[sic]. However, Pod parsers are not required to make this
969distinction.
970.IP "\(bu" 4
971Note that E<number> \fImust not\fR be interpreted as simply
972"codepoint \fInumber\fR in the current/native character set\*(L". It always
973means only \*(R"the character represented by codepoint \fInumber\fR in
974Unicode." (This is identical to the semantics of &#\fInumber\fR; in \s-1XML\s0.)
975.Sp
976This will likely require many formatters to have tables mapping from
977treatable Unicode codepoints (such as the \*(L"\exE9\*(R" for the e\-acute
978character) to the escape sequences or codes necessary for conveying
979such sequences in the target output format. A converter to *roff
980would, for example know that \*(L"\exE9\*(R" (whether conveyed literally, or via
981a E<...> sequence) is to be conveyed as \*(L"e\e\e*'\*(R".
982Similarly, a program rendering Pod in a Mac \s-1OS\s0 application window, would
983presumably need to know that \*(L"\exE9\*(R" maps to codepoint 142 in MacRoman
984encoding that (at time of writing) is native for Mac \s-1OS\s0. Such
985Unicode2whatever mappings are presumably already widely available for
986common output formats. (Such mappings may be incomplete! Implementers
987are not expected to bend over backwards in an attempt to render
988Cherokee syllabics, Etruscan runes, Byzantine musical symbols, or any
989of the other weird things that Unicode can encode.) And
990if a Pod document uses a character not found in such a mapping, the
991formatter should consider it an unrenderable character.
992.IP "\(bu" 4
993If, surprisingly, the implementor of a Pod formatter can't find a
994satisfactory pre-existing table mapping from Unicode characters to
995escapes in the target format (e.g., a decent table of Unicode
996characters to *roff escapes), it will be necessary to build such a
997table. If you are in this circumstance, you should begin with the
998characters in the range 0x00A0 \- 0x00FF, which is mostly the heavily
999used accented characters. Then proceed (as patience permits and
1000fastidiousness compels) through the characters that the (X)HTML
1001standards groups judged important enough to merit mnemonics
1002for. These are declared in the (X)HTML specifications at the
1003www.W3.org site. At time of writing (September 2001), the most recent
1004entity declaration files are:
1005.Sp
1006.Vb 3
1007\& http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent
1008\& http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent
1009\& http://www.w3.org/TR/xhtml1/DTD/xhtml-symbol.ent
1010.Ve
1011.Sp
1012Then you can progress through any remaining notable Unicode characters
1013in the range 0x2000\-0x204D (consult the character tables at
1014www.unicode.org), and whatever else strikes your fancy. For example,
1015in \fIxhtml\-symbol.ent\fR, there is the entry:
1016.Sp
1017.Vb 1
1018\& <!ENTITY infin "&#8734;"> <!-- infinity, U+221E ISOtech -->
1019.Ve
1020.Sp
1021While the mapping \*(L"infin\*(R" to the character \*(L"\ex{221E}\*(R" will (hopefully)
1022have been already handled by the Pod parser, the presence of the
1023character in this file means that it's reasonably important enough to
1024include in a formatter's table that maps from notable Unicode characters
1025to the codes necessary for rendering them. So for a Unicode\-to\-*roff
1026mapping, for example, this would merit the entry:
1027.Sp
1028.Vb 1
1029\& "\ex{221E}" => '\e(in',
1030.Ve
1031.Sp
1032It is eagerly hoped that in the future, increasing numbers of formats
1033(and formatters) will support Unicode characters directly (as (X)HTML
1034does with \f(CW\*(C`&infin;\*(C'\fR, \f(CW\*(C`&#8734;\*(C'\fR, or \f(CW\*(C`&#x221E;\*(C'\fR), reducing the need
1035for idiosyncratic mappings of Unicode\-to\-\fImy_escapes\fR.
1036.IP "\(bu" 4
1037It is up to individual Pod formatter to display good judgment when
1038confronted with an unrenderable character (which is distinct from an
1039unknown E<thing> sequence that the parser couldn't resolve to
1040anything, renderable or not). It is good practice to map Latin letters
1041with diacritics (like "E<eacute>\*(L"/\*(R"E<233>\*(L") to the corresponding
1042unaccented US-ASCII letters (like a simple character 101, \*(R"e\*(L"), but
1043clearly this is often not feasible, and an unrenderable character may
1044be represented as \*(R"?", or the like. In attempting a sane fallback
1045(as from E<233> to \*(L"e\*(R"), Pod formatters may use the
1046\&\f(CW%Latin1Code_to_fallback\fR table in Pod::Escapes, or
1047Text::Unidecode, if available.
1048.Sp
1049For example, this Pod text:
1050.Sp
1051.Vb 1
1052\& magic is enabled if you set C<$Currency> to 'E<euro>'.
1053.Ve
1054.Sp
1055may be rendered as:
1056"magic is enabled if you set \f(CW$Currency\fR to '\fI?\fR'\*(L" or as
1057\&\*(R"magic is enabled if you set \f(CW$Currency\fR to '\fB[euro]\fR'\*(L", or as
1058\&\*(R"magic is enabled if you set \f(CW$Currency\fR to '[x20AC]', etc.
1059.Sp
1060A Pod formatter may also note, in a comment or warning, a list of what
1061unrenderable characters were encountered.
1062.IP "\(bu" 4
1063E<...> may freely appear in any formatting code (other than
1064in another E<...> or in an Z<>). That is, "X<The
1065E<euro>1,000,000 Solution>\*(L" is valid, as is \*(R"L<The
1066E<euro>1,000,000 Solution|Million::Euros>".
1067.IP "\(bu" 4
1068Some Pod formatters output to formats that implement nonbreaking
1069spaces as an individual character (which I'll call \*(L"\s-1NBSP\s0\*(R"), and
1070others output to formats that implement nonbreaking spaces just as
1071spaces wrapped in a \*(L"don't break this across lines\*(R" code. Note that
1072at the level of Pod, both sorts of codes can occur: Pod can contain a
1073\&\s-1NBSP\s0 character (whether as a literal, or as a "E<160>\*(L" or
1074\&\*(R"E<nbsp>\*(L" code); and Pod can contain \*(R"S<foo
1075I<bar> baz>\*(L" codes, where \*(R"mere spaces\*(L" (character 32) in
1076such codes are taken to represent nonbreaking spaces. Pod
1077parsers should consider supporting the optional parsing of \*(R"S<foo
1078I<bar> baz>\*(L" as if it were
1079\&\*(R"foo\fI\s-1NBSP\s0\fRI<bar>\fI\s-1NBSP\s0\fRbaz", and, going the other way, the
1080optional parsing of groups of words joined by \s-1NBSP\s0's as if each group
1081were in a S<...> code, so that formatters may use the
1082representation that maps best to what the output format demands.
1083.IP "\(bu" 4
1084Some processors may find that the \f(CW\*(C`S<...>\*(C'\fR code is easiest to
1085implement by replacing each space in the parse tree under the content
1086of the S, with an \s-1NBSP\s0. But note: the replacement should apply \fInot\fR to
1087spaces in \fIall\fR text, but \fIonly\fR to spaces in \fIprintable\fR text. (This
1088distinction may or may not be evident in the particular tree/event
1089model implemented by the Pod parser.) For example, consider this
1090unusual case:
1091.Sp
1092.Vb 1
1093\& S<L</Autoloaded Functions>>
1094.Ve
1095.Sp
1096This means that the space in the middle of the visible link text must
1097not be broken across lines. In other words, it's the same as this:
1098.Sp
1099.Vb 1
1100\& L<"AutoloadedE<160>Functions"/Autoloaded Functions>
1101.Ve
1102.Sp
1103However, a misapplied space-to-NBSP replacement could (wrongly)
1104produce something equivalent to this:
1105.Sp
1106.Vb 1
1107\& L<"AutoloadedE<160>Functions"/AutoloadedE<160>Functions>
1108.Ve
1109.Sp
1110\&...which is almost definitely not going to work as a hyperlink (assuming
1111this formatter outputs a format supporting hypertext).
1112.Sp
1113Formatters may choose to just not support the S format code,
1114especially in cases where the output format simply has no \s-1NBSP\s0
1115character/code and no code for \*(L"don't break this stuff across lines\*(R".
1116.IP "\(bu" 4
1117Besides the \s-1NBSP\s0 character discussed above, implementors are reminded
1118of the existence of the other \*(L"special\*(R" character in Latin\-1, the
1119\&\*(L"soft hyphen\*(R" character, also known as \*(L"discretionary hyphen\*(R",
1120i.e. \f(CW\*(C`E<173>\*(C'\fR = \f(CW\*(C`E<0xAD>\*(C'\fR =
1121\&\f(CW\*(C`E<shy>\*(C'\fR). This character expresses an optional hyphenation
1122point. That is, it normally renders as nothing, but may render as a
1123\&\*(L"\-\*(R" if a formatter breaks the word at that point. Pod formatters
1124should, as appropriate, do one of the following: 1) render this with
1125a code with the same meaning (e.g., \*(L"\e\-\*(R" in \s-1RTF\s0), 2) pass it through
1126in the expectation that the formatter understands this character as
1127such, or 3) delete it.
1128.Sp
1129For example:
1130.Sp
1131.Vb 3
1132\& sigE<shy>action
1133\& manuE<shy>script
1134\& JarkE<shy>ko HieE<shy>taE<shy>nieE<shy>mi
1135.Ve
1136.Sp
1137These signal to a formatter that if it is to hyphenate \*(L"sigaction\*(R"
1138or \*(L"manuscript\*(R", then it should be done as
1139"sig\-\fI[linebreak]\fRaction\*(L" or \*(R"manu\-\fI[linebreak]\fRscript"
1140(and if it doesn't hyphenate it, then the \f(CW\*(C`E<shy>\*(C'\fR doesn't
1141show up at all). And if it is
1142to hyphenate \*(L"Jarkko\*(R" and/or \*(L"Hietaniemi\*(R", it can do
1143so only at the points where there is a \f(CW\*(C`E<shy>\*(C'\fR code.
1144.Sp
1145In practice, it is anticipated that this character will not be used
1146often, but formatters should either support it, or delete it.
1147.IP "\(bu" 4
1148If you think that you want to add a new command to Pod (like, say, a
1149\&\*(L"=biblio\*(R" command), consider whether you could get the same
1150effect with a for or begin/end sequence: \*(L"=for biblio ...\*(R" or \*(L"=begin
1151biblio\*(R" ... \*(L"=end biblio\*(R". Pod processors that don't understand
1152\&\*(L"=for biblio\*(R", etc, will simply ignore it, whereas they may complain
1153loudly if they see \*(L"=biblio\*(R".
1154.IP "\(bu" 4
1155Throughout this document, \*(L"Pod\*(R" has been the preferred spelling for
1156the name of the documentation format. One may also use \*(L"\s-1POD\s0\*(R" or
1157\&\*(L"pod\*(R". For the documentation that is (typically) in the Pod
1158format, you may use \*(L"pod\*(R", or \*(L"Pod\*(R", or \*(L"\s-1POD\s0\*(R". Understanding these
1159distinctions is useful; but obsessing over how to spell them, usually
1160is not.
1161.SH "About L<...> Codes"
1162.IX Header "About L<...> Codes"
1163As you can tell from a glance at perlpod, the L<...>
1164code is the most complex of the Pod formatting codes. The points below
1165will hopefully clarify what it means and how processors should deal
1166with it.
1167.IP "\(bu" 4
1168In parsing an L<...> code, Pod parsers must distinguish at least
1169four attributes:
1170.RS 4
1171.IP "First:" 4
1172.IX Item "First:"
1173The link\-text. If there is none, this must be undef. (E.g., in
1174"L<Perl Functions|perlfunc>\*(L", the link-text is \*(R"Perl Functions\*(L".
1175In \*(R"L<Time::HiRes>\*(L" and even \*(R"L<|Time::HiRes>", there is no
1176link text. Note that link text may contain formatting.)
1177.IP "Second:" 4
1178.IX Item "Second:"
1179The possibly inferred link-text \*(-- i.e., if there was no real link
1180text, then this is the text that we'll infer in its place. (E.g., for
1181"L<Getopt::Std>\*(L", the inferred link text is \*(R"Getopt::Std".)
1182.IP "Third:" 4
1183.IX Item "Third:"
1184The name or \s-1URL\s0, or undef if none. (E.g., in "L<Perl
1185Functions|perlfunc>\*(L", the name \*(-- also sometimes called the page \*(--
1186is \*(R"perlfunc\*(L". In \*(R"L</CAVEATS>", the name is undef.)
1187.IP "Fourth:" 4
1188.IX Item "Fourth:"
1189The section (\s-1AKA\s0 \*(L"item\*(R" in older perlpods), or undef if none. E.g.,
1190in \*(L"\s-1DESCRIPTION\s0\*(R" in Getopt::Std, \*(L"\s-1DESCRIPTION\s0\*(R" is the section. (Note
1191that this is not the same as a manpage section like the \*(L"5\*(R" in \*(L"man 5
1192crontab\*(R". \*(L"Section Foo\*(R" in the Pod sense means the part of the text
1193that's introduced by the heading or item whose text is \*(L"Foo\*(R".)
1194.RE
1195.RS 4
1196.Sp
1197Pod parsers may also note additional attributes including:
1198.IP "Fifth:" 4
1199.IX Item "Fifth:"
1200A flag for whether item 3 (if present) is a \s-1URL\s0 (like
1201\&\*(L"http://lists.perl.org\*(R" is), in which case there should be no section
1202attribute; a Pod name (like \*(L"perldoc\*(R" and \*(L"Getopt::Std\*(R" are); or
1203possibly a man page name (like \*(L"\fIcrontab\fR\|(5)\*(R" is).
1204.IP "Sixth:" 4
1205.IX Item "Sixth:"
1206The raw original L<...> content, before text is split on
1207\&\*(L"|\*(R", \*(L"/\*(R", etc, and before E<...> codes are expanded.
1208.RE
1209.RS 4
1210.Sp
1211(The above were numbered only for concise reference below. It is not
1212a requirement that these be passed as an actual list or array.)
1213.Sp
1214For example:
1215.Sp
1216.Vb 7
1217\& L<Foo::Bar>
1218\& => undef, # link text
1219\& "Foo::Bar", # possibly inferred link text
1220\& "Foo::Bar", # name
1221\& undef, # section
1222\& 'pod', # what sort of link
1223\& "Foo::Bar" # original content
1224.Ve
1225.Sp
1226.Vb 7
1227\& L<Perlport's section on NL's|perlport/Newlines>
1228\& => "Perlport's section on NL's", # link text
1229\& "Perlport's section on NL's", # possibly inferred link text
1230\& "perlport", # name
1231\& "Newlines", # section
1232\& 'pod', # what sort of link
1233\& "Perlport's section on NL's|perlport/Newlines" # orig. content
1234.Ve
1235.Sp
1236.Vb 7
1237\& L<perlport/Newlines>
1238\& => undef, # link text
1239\& '"Newlines" in perlport', # possibly inferred link text
1240\& "perlport", # name
1241\& "Newlines", # section
1242\& 'pod', # what sort of link
1243\& "perlport/Newlines" # original content
1244.Ve
1245.Sp
1246.Vb 7
1247\& L<crontab(5)/"DESCRIPTION">
1248\& => undef, # link text
1249\& '"DESCRIPTION" in crontab(5)', # possibly inferred link text
1250\& "crontab(5)", # name
1251\& "DESCRIPTION", # section
1252\& 'man', # what sort of link
1253\& 'crontab(5)/"DESCRIPTION"' # original content
1254.Ve
1255.Sp
1256.Vb 7
1257\& L</Object Attributes>
1258\& => undef, # link text
1259\& '"Object Attributes"', # possibly inferred link text
1260\& undef, # name
1261\& "Object Attributes", # section
1262\& 'pod', # what sort of link
1263\& "/Object Attributes" # original content
1264.Ve
1265.Sp
1266.Vb 7
1267\& L<http://www.perl.org/>
1268\& => undef, # link text
1269\& "http://www.perl.org/", # possibly inferred link text
1270\& "http://www.perl.org/", # name
1271\& undef, # section
1272\& 'url', # what sort of link
1273\& "http://www.perl.org/" # original content
1274.Ve
1275.Sp
1276Note that you can distinguish URL-links from anything else by the
1277fact that they match \f(CW\*(C`m/\eA\ew+:[^:\es]\eS*\ez/\*(C'\fR. So
1278\&\f(CW\*(C`L<http://www.perl.com>\*(C'\fR is a \s-1URL\s0, but
1279\&\f(CW\*(C`L<HTTP::Response>\*(C'\fR isn't.
1280.RE
1281.IP "\(bu" 4
1282In case of L<...> codes with no \*(L"text|\*(R" part in them,
1283older formatters have exhibited great variation in actually displaying
1284the link or cross reference. For example, L<\fIcrontab\fR\|(5)> would render
1285as "the \f(CWcrontab(5)\fR manpage\*(L", or \*(R"in the \f(CWcrontab(5)\fR manpage\*(L"
1286or just \*(R"\f(CWcrontab(5)\fR".
1287.Sp
1288Pod processors must now treat \*(L"text|\*(R"\-less links as follows:
1289.Sp
1290.Vb 3
1291\& L<name> => L<name|name>
1292\& L</section> => L<"section"|/section>
1293\& L<name/section> => L<"section" in name|name/section>
1294.Ve
1295.IP "\(bu" 4
1296Note that section names might contain markup. I.e., if a section
1297starts with:
1298.Sp
1299.Vb 1
1300\& =head2 About the C<-M> Operator
1301.Ve
1302.Sp
1303or with:
1304.Sp
1305.Vb 1
1306\& =item About the C<-M> Operator
1307.Ve
1308.Sp
1309then a link to it would look like this:
1310.Sp
1311.Vb 1
1312\& L<somedoc/About the C<-M> Operator>
1313.Ve
1314.Sp
1315Formatters may choose to ignore the markup for purposes of resolving
1316the link and use only the renderable characters in the section name,
1317as in:
1318.Sp
1319.Vb 2
1320\& <h1><a name="About_the_-M_Operator">About the <code>-M</code>
1321\& Operator</h1>
1322.Ve
1323.Sp
1324.Vb 1
1325\& ...
1326.Ve
1327.Sp
1328.Vb 2
1329\& <a href="somedoc#About_the_-M_Operator">About the <code>-M</code>
1330\& Operator" in somedoc</a>
1331.Ve
1332.IP "\(bu" 4
1333Previous versions of perlpod distinguished \f(CW\*(C`L<name/"section">\*(C'\fR
1334links from \f(CW\*(C`L<name/item>\*(C'\fR links (and their targets). These
1335have been merged syntactically and semantically in the current
1336specification, and \fIsection\fR can refer either to a "=head\fIn\fR Heading
1337Content\*(L" command or to a \*(R"=item Item Content" command. This
1338specification does not specify what behavior should be in the case
1339of a given document having several things all seeming to produce the
1340same \fIsection\fR identifier (e.g., in \s-1HTML\s0, several things all producing
1341the same \fIanchorname\fR in <a name="\fIanchorname\fR">...</a>
1342elements). Where Pod processors can control this behavior, they should
1343use the first such anchor. That is, \f(CW\*(C`L<Foo/Bar>\*(C'\fR refers to the
1344\&\fIfirst\fR \*(L"Bar\*(R" section in Foo.
1345.Sp
1346But for some processors/formats this cannot be easily controlled; as
1347with the \s-1HTML\s0 example, the behavior of multiple ambiguous
1348<a name="\fIanchorname\fR">...</a> is most easily just left up to
1349browsers to decide.
1350.IP "\(bu" 4
1351Authors wanting to link to a particular (absolute) \s-1URL\s0, must do so
1352only with "L<scheme:...>" codes (like
1353L<http://www.perl.org>), and must not attempt "L<Some Site
1354Name|scheme:...>" codes. This restriction avoids many problems
1355in parsing and rendering L<...> codes.
1356.IP "\(bu" 4
1357In a \f(CW\*(C`L<text|...>\*(C'\fR code, text may contain formatting codes
1358for formatting or for E<...> escapes, as in:
1359.Sp
1360.Vb 1
1361\& L<B<ummE<234>stuff>|...>
1362.Ve
1363.Sp
1364For \f(CW\*(C`L<...>\*(C'\fR codes without a \*(L"name|\*(R" part, only
1365\&\f(CW\*(C`E<...>\*(C'\fR and \f(CW\*(C`Z<>\*(C'\fR codes may occur \*(-- no
1366other formatting codes. That is, authors should not use
1367"\f(CW\*(C`L<B<Foo::Bar>>\*(C'\fR".
1368.Sp
1369Note, however, that formatting codes and Z<>'s can occur in any
1370and all parts of an L<...> (i.e., in \fIname\fR, \fIsection\fR, \fItext\fR,
1371and \fIurl\fR).
1372.Sp
1373Authors must not nest L<...> codes. For example, "L<The
1374L<Foo::Bar> man page>" should be treated as an error.
1375.IP "\(bu" 4
1376Note that Pod authors may use formatting codes inside the \*(L"text\*(R"
1377part of "L<text|name>" (and so on for L<text|/\*(L"sec\*(R">).
1378.Sp
1379In other words, this is valid:
1380.Sp
1381.Vb 1
1382\& Go read L<the docs on C<$.>|perlvar/"$.">
1383.Ve
1384.Sp
1385Some output formats that do allow rendering "L<...>" codes as
1386hypertext, might not allow the link-text to be formatted; in
1387that case, formatters will have to just ignore that formatting.
1388.IP "\(bu" 4
1389At time of writing, \f(CW\*(C`L<name>\*(C'\fR values are of two types:
1390either the name of a Pod page like \f(CW\*(C`L<Foo::Bar>\*(C'\fR (which
1391might be a real Perl module or program in an \f(CW@INC\fR / \s-1PATH\s0
1392directory, or a .pod file in those places); or the name of a \s-1UNIX\s0
1393man page, like \f(CW\*(C`L<crontab(5)>\*(C'\fR. In theory, \f(CW\*(C`L<chmod>\*(C'\fR
1394in ambiguous between a Pod page called \*(L"chmod\*(R", or the Unix man page
1395\&\*(L"chmod\*(R" (in whatever man\-section). However, the presence of a string
1396in parens, as in \*(L"\fIcrontab\fR\|(5)\*(R", is sufficient to signal that what
1397is being discussed is not a Pod page, and so is presumably a
1398\&\s-1UNIX\s0 man page. The distinction is of no importance to many
1399Pod processors, but some processors that render to hypertext formats
1400may need to distinguish them in order to know how to render a
1401given \f(CW\*(C`L<foo>\*(C'\fR code.
1402.IP "\(bu" 4
1403Previous versions of perlpod allowed for a \f(CW\*(C`L<section>\*(C'\fR syntax
1404(as in "\f(CW\*(C`L<Object Attributes>\*(C'\fR"), which was not easily distinguishable
1405from \f(CW\*(C`L<name>\*(C'\fR syntax. This syntax is no longer in the
1406specification, and has been replaced by the \f(CW\*(C`L<"section">\*(C'\fR syntax
1407(where the quotes were formerly optional). Pod parsers should tolerate
1408the \f(CW\*(C`L<section>\*(C'\fR syntax, for a while at least. The suggested
1409heuristic for distinguishing \f(CW\*(C`L<section>\*(C'\fR from \f(CW\*(C`L<name>\*(C'\fR
1410is that if it contains any whitespace, it's a \fIsection\fR. Pod processors
1411may warn about this being deprecated syntax.
1412.SH "About =over...=back Regions"
1413.IX Header "About =over...=back Regions"
1414\&\*(L"=over\*(R"...\*(L"=back\*(R" regions are used for various kinds of list-like
1415structures. (I use the term \*(L"region\*(R" here simply as a collective
1416term for everything from the \*(L"=over\*(R" to the matching \*(L"=back\*(R".)
1417.IP "\(bu" 4
1418The non-zero numeric \fIindentlevel\fR in "=over \fIindentlevel\fR\*(L" ...
1419\&\*(R"=back\*(L" is used for giving the formatter a clue as to how many
1420\&\*(R"spaces" (ems, or roughly equivalent units) it should tab over,
1421although many formatters will have to convert this to an absolute
1422measurement that may not exactly match with the size of spaces (or M's)
1423in the document's base font. Other formatters may have to completely
1424ignore the number. The lack of any explicit \fIindentlevel\fR parameter is
1425equivalent to an \fIindentlevel\fR value of 4. Pod processors may
1426complain if \fIindentlevel\fR is present but is not a positive number
1427matching \f(CW\*(C`m/\eA(\ed*\e.)?\ed+\ez/\*(C'\fR.
1428.IP "\(bu" 4
1429Authors of Pod formatters are reminded that \*(L"=over\*(R" ... \*(L"=back\*(R" may
1430map to several different constructs in your output format. For
1431example, in converting Pod to (X)HTML, it can map to any of
1432<ul>...</ul>, <ol>...</ol>, <dl>...</dl>, or
1433<blockquote>...</blockquote>. Similarly, \*(L"=item\*(R" can map to <li> or
1434<dt>.
1435.IP "\(bu" 4
1436Each \*(L"=over\*(R" ... \*(L"=back\*(R" region should be one of the following:
1437.RS 4
1438.IP "\(bu" 4
1439An \*(L"=over\*(R" ... \*(L"=back\*(R" region containing only \*(L"=item *\*(R" commands,
1440each followed by some number of ordinary/verbatim paragraphs, other
1441nested \*(L"=over\*(R" ... \*(L"=back\*(R" regions, \*(L"=for...\*(R" paragraphs, and
1442\&\*(L"=begin\*(R"...\*(L"=end\*(R" regions.
1443.Sp
1444(Pod processors must tolerate a bare \*(L"=item\*(R" as if it were \*(L"=item
1445*\*(R".) Whether \*(L"*\*(R" is rendered as a literal asterisk, an \*(L"o\*(R", or as
1446some kind of real bullet character, is left up to the Pod formatter,
1447and may depend on the level of nesting.
1448.IP "\(bu" 4
1449An \*(L"=over\*(R" ... \*(L"=back\*(R" region containing only
1450\&\f(CW\*(C`m/\eA=item\es+\ed+\e.?\es*\ez/\*(C'\fR paragraphs, each one (or each group of them)
1451followed by some number of ordinary/verbatim paragraphs, other nested
1452\&\*(L"=over\*(R" ... \*(L"=back\*(R" regions, \*(L"=for...\*(R" paragraphs, and/or
1453\&\*(L"=begin\*(R"...\*(L"=end\*(R" codes. Note that the numbers must start at 1
1454in each section, and must proceed in order and without skipping
1455numbers.
1456.Sp
1457(Pod processors must tolerate lines like \*(L"=item 1\*(R" as if they were
1458\&\*(L"=item 1.\*(R", with the period.)
1459.IP "\(bu" 4
1460An \*(L"=over\*(R" ... \*(L"=back\*(R" region containing only \*(L"=item [text]\*(R"
1461commands, each one (or each group of them) followed by some number of
1462ordinary/verbatim paragraphs, other nested \*(L"=over\*(R" ... \*(L"=back\*(R"
1463regions, or \*(L"=for...\*(R" paragraphs, and \*(L"=begin\*(R"...\*(L"=end\*(R" regions.
1464.Sp
1465The \*(L"=item [text]\*(R" paragraph should not match
1466\&\f(CW\*(C`m/\eA=item\es+\ed+\e.?\es*\ez/\*(C'\fR or \f(CW\*(C`m/\eA=item\es+\e*\es*\ez/\*(C'\fR, nor should it
1467match just \f(CW\*(C`m/\eA=item\es*\ez/\*(C'\fR.
1468.IP "\(bu" 4
1469An \*(L"=over\*(R" ... \*(L"=back\*(R" region containing no \*(L"=item\*(R" paragraphs at
1470all, and containing only some number of
1471ordinary/verbatim paragraphs, and possibly also some nested \*(L"=over\*(R"
1472\&... \*(L"=back\*(R" regions, \*(L"=for...\*(R" paragraphs, and \*(L"=begin\*(R"...\*(L"=end\*(R"
1473regions. Such an itemless \*(L"=over\*(R" ... \*(L"=back\*(R" region in Pod is
1474equivalent in meaning to a \*(L"<blockquote>...</blockquote>\*(R" element in
1475\&\s-1HTML\s0.
1476.RE
1477.RS 4
1478.Sp
1479Note that with all the above cases, you can determine which type of
1480\&\*(L"=over\*(R" ... \*(L"=back\*(R" you have, by examining the first (non\-\*(L"=cut\*(R",
1481non\-\*(L"=pod\*(R") Pod paragraph after the \*(L"=over\*(R" command.
1482.RE
1483.IP "\(bu" 4
1484Pod formatters \fImust\fR tolerate arbitrarily large amounts of text
1485in the "=item \fItext...\fR" paragraph. In practice, most such
1486paragraphs are short, as in:
1487.Sp
1488.Vb 1
1489\& =item For cutting off our trade with all parts of the world
1490.Ve
1491.Sp
1492But they may be arbitrarily long:
1493.Sp
1494.Vb 2
1495\& =item For transporting us beyond seas to be tried for pretended
1496\& offenses
1497.Ve
1498.Sp
1499.Vb 5
1500\& =item He is at this time transporting large armies of foreign
1501\& mercenaries to complete the works of death, desolation and
1502\& tyranny, already begun with circumstances of cruelty and perfidy
1503\& scarcely paralleled in the most barbarous ages, and totally
1504\& unworthy the head of a civilized nation.
1505.Ve
1506.IP "\(bu" 4
1507Pod processors should tolerate \*(L"=item *\*(R" / "=item \fInumber\fR" commands
1508with no accompanying paragraph. The middle item is an example:
1509.Sp
1510.Vb 1
1511\& =over
1512.Ve
1513.Sp
1514.Vb 1
1515\& =item 1
1516.Ve
1517.Sp
1518.Vb 1
1519\& Pick up dry cleaning.
1520.Ve
1521.Sp
1522.Vb 1
1523\& =item 2
1524.Ve
1525.Sp
1526.Vb 1
1527\& =item 3
1528.Ve
1529.Sp
1530.Vb 1
1531\& Stop by the store. Get Abba Zabas, Stoli, and cheap lawn chairs.
1532.Ve
1533.Sp
1534.Vb 1
1535\& =back
1536.Ve
1537.IP "\(bu" 4
1538No \*(L"=over\*(R" ... \*(L"=back\*(R" region can contain headings. Processors may
1539treat such a heading as an error.
1540.IP "\(bu" 4
1541Note that an \*(L"=over\*(R" ... \*(L"=back\*(R" region should have some
1542content. That is, authors should not have an empty region like this:
1543.Sp
1544.Vb 1
1545\& =over
1546.Ve
1547.Sp
1548.Vb 1
1549\& =back
1550.Ve
1551.Sp
1552Pod processors seeing such a contentless \*(L"=over\*(R" ... \*(L"=back\*(R" region,
1553may ignore it, or may report it as an error.
1554.IP "\(bu" 4
1555Processors must tolerate an \*(L"=over\*(R" list that goes off the end of the
1556document (i.e., which has no matching \*(L"=back\*(R"), but they may warn
1557about such a list.
1558.IP "\(bu" 4
1559Authors of Pod formatters should note that this construct:
1560.Sp
1561.Vb 1
1562\& =item Neque
1563.Ve
1564.Sp
1565.Vb 1
1566\& =item Porro
1567.Ve
1568.Sp
1569.Vb 1
1570\& =item Quisquam Est
1571.Ve
1572.Sp
1573.Vb 3
1574\& Qui dolorem ipsum quia dolor sit amet, consectetur, adipisci
1575\& velit, sed quia non numquam eius modi tempora incidunt ut
1576\& labore et dolore magnam aliquam quaerat voluptatem.
1577.Ve
1578.Sp
1579.Vb 1
1580\& =item Ut Enim
1581.Ve
1582.Sp
1583is semantically ambiguous, in a way that makes formatting decisions
1584a bit difficult. On the one hand, it could be mention of an item
1585\&\*(L"Neque\*(R", mention of another item \*(L"Porro\*(R", and mention of another
1586item \*(L"Quisquam Est\*(R", with just the last one requiring the explanatory
1587paragraph \*(L"Qui dolorem ipsum quia dolor...\*(R"; and then an item
1588\&\*(L"Ut Enim\*(R". In that case, you'd want to format it like so:
1589.Sp
1590.Vb 1
1591\& Neque
1592.Ve
1593.Sp
1594.Vb 1
1595\& Porro
1596.Ve
1597.Sp
1598.Vb 4
1599\& Quisquam Est
1600\& Qui dolorem ipsum quia dolor sit amet, consectetur, adipisci
1601\& velit, sed quia non numquam eius modi tempora incidunt ut
1602\& labore et dolore magnam aliquam quaerat voluptatem.
1603.Ve
1604.Sp
1605.Vb 1
1606\& Ut Enim
1607.Ve
1608.Sp
1609But it could equally well be a discussion of three (related or equivalent)
1610items, \*(L"Neque\*(R", \*(L"Porro\*(R", and \*(L"Quisquam Est\*(R", followed by a paragraph
1611explaining them all, and then a new item \*(L"Ut Enim\*(R". In that case, you'd
1612probably want to format it like so:
1613.Sp
1614.Vb 6
1615\& Neque
1616\& Porro
1617\& Quisquam Est
1618\& Qui dolorem ipsum quia dolor sit amet, consectetur, adipisci
1619\& velit, sed quia non numquam eius modi tempora incidunt ut
1620\& labore et dolore magnam aliquam quaerat voluptatem.
1621.Ve
1622.Sp
1623.Vb 1
1624\& Ut Enim
1625.Ve
1626.Sp
1627But (for the forseeable future), Pod does not provide any way for Pod
1628authors to distinguish which grouping is meant by the above
1629\&\*(L"=item\*(R"\-cluster structure. So formatters should format it like so:
1630.Sp
1631.Vb 1
1632\& Neque
1633.Ve
1634.Sp
1635.Vb 1
1636\& Porro
1637.Ve
1638.Sp
1639.Vb 1
1640\& Quisquam Est
1641.Ve
1642.Sp
1643.Vb 3
1644\& Qui dolorem ipsum quia dolor sit amet, consectetur, adipisci
1645\& velit, sed quia non numquam eius modi tempora incidunt ut
1646\& labore et dolore magnam aliquam quaerat voluptatem.
1647.Ve
1648.Sp
1649.Vb 1
1650\& Ut Enim
1651.Ve
1652.Sp
1653That is, there should be (at least roughly) equal spacing between
1654items as between paragraphs (although that spacing may well be less
1655than the full height of a line of text). This leaves it to the reader
1656to use (con)textual cues to figure out whether the \*(L"Qui dolorem
1657ipsum...\*(R" paragraph applies to the \*(L"Quisquam Est\*(R" item or to all three
1658items \*(L"Neque\*(R", \*(L"Porro\*(R", and \*(L"Quisquam Est\*(R". While not an ideal
1659situation, this is preferable to providing formatting cues that may
1660be actually contrary to the author's intent.
1661.ie n .SH "About Data Paragraphs and ""=begin/=end"" Regions"
1662.el .SH "About Data Paragraphs and ``=begin/=end'' Regions"
1663.IX Header "About Data Paragraphs and =begin/=end Regions"
1664Data paragraphs are typically used for inlining non-Pod data that is
1665to be used (typically passed through) when rendering the document to
1666a specific format:
1667.PP
1668.Vb 1
1669\& =begin rtf
1670.Ve
1671.PP
1672.Vb 1
1673\& \epar{\epard\eqr\esa4500{\ei Printed\e~\echdate\e~\echtime}\epar}
1674.Ve
1675.PP
1676.Vb 1
1677\& =end rtf
1678.Ve
1679.PP
1680The exact same effect could, incidentally, be achieved with a single
1681\&\*(L"=for\*(R" paragraph:
1682.PP
1683.Vb 1
1684\& =for rtf \epar{\epard\eqr\esa4500{\ei Printed\e~\echdate\e~\echtime}\epar}
1685.Ve
1686.PP
1687(Although that is not formally a data paragraph, it has the same
1688meaning as one, and Pod parsers may parse it as one.)
1689.PP
1690Another example of a data paragraph:
1691.PP
1692.Vb 1
1693\& =begin html
1694.Ve
1695.PP
1696.Vb 1
1697\& I like <em>PIE</em>!
1698.Ve
1699.PP
1700.Vb 1
1701\& <hr>Especially pecan pie!
1702.Ve
1703.PP
1704.Vb 1
1705\& =end html
1706.Ve
1707.PP
1708If these were ordinary paragraphs, the Pod parser would try to
1709expand the "E</em>\*(L" (in the first paragraph) as a formatting
1710code, just like \*(R"E<lt>\*(L" or \*(R"E<eacute>\*(L". But since this
1711is in a \*(R"=begin \fIidentifier\fR\*(L"...\*(R"=end \fIidentifier\fR" region \fIand\fR
1712the identifier \*(L"html\*(R" doesn't begin have a \*(L":\*(R" prefix, the contents
1713of this region are stored as data paragraphs, instead of being
1714processed as ordinary paragraphs (or if they began with a spaces
1715and/or tabs, as verbatim paragraphs).
1716.PP
1717As a further example: At time of writing, no \*(L"biblio\*(R" identifier is
1718supported, but suppose some processor were written to recognize it as
1719a way of (say) denoting a bibliographic reference (necessarily
1720containing formatting codes in ordinary paragraphs). The fact that
1721\&\*(L"biblio\*(R" paragraphs were meant for ordinary processing would be
1722indicated by prefacing each \*(L"biblio\*(R" identifier with a colon:
1723.PP
1724.Vb 1
1725\& =begin :biblio
1726.Ve
1727.PP
1728.Vb 2
1729\& Wirth, Niklaus. 1976. I<Algorithms + Data Structures =
1730\& Programs.> Prentice-Hall, Englewood Cliffs, NJ.
1731.Ve
1732.PP
1733.Vb 1
1734\& =end :biblio
1735.Ve
1736.PP
1737This would signal to the parser that paragraphs in this begin...end
1738region are subject to normal handling as ordinary/verbatim paragraphs
1739(while still tagged as meant only for processors that understand the
1740\&\*(L"biblio\*(R" identifier). The same effect could be had with:
1741.PP
1742.Vb 3
1743\& =for :biblio
1744\& Wirth, Niklaus. 1976. I<Algorithms + Data Structures =
1745\& Programs.> Prentice-Hall, Englewood Cliffs, NJ.
1746.Ve
1747.PP
1748The \*(L":\*(R" on these identifiers means simply \*(L"process this stuff
1749normally, even though the result will be for some special target\*(R".
1750I suggest that parser APIs report \*(L"biblio\*(R" as the target identifier,
1751but also report that it had a \*(L":\*(R" prefix. (And similarly, with the
1752above \*(L"html\*(R", report \*(L"html\*(R" as the target identifier, and note the
1753\&\fIlack\fR of a \*(L":\*(R" prefix.)
1754.PP
1755Note that a "=begin \fIidentifier\fR\*(L"...\*(R"=end \fIidentifier\fR" region where
1756\&\fIidentifier\fR begins with a colon, \fIcan\fR contain commands. For example:
1757.PP
1758.Vb 1
1759\& =begin :biblio
1760.Ve
1761.PP
1762.Vb 1
1763\& Wirth's classic is available in several editions, including:
1764.Ve
1765.PP
1766.Vb 2
1767\& =for comment
1768\& hm, check abebooks.com for how much used copies cost.
1769.Ve
1770.PP
1771.Vb 1
1772\& =over
1773.Ve
1774.PP
1775.Vb 1
1776\& =item
1777.Ve
1778.PP
1779.Vb 2
1780\& Wirth, Niklaus. 1975. I<Algorithmen und Datenstrukturen.>
1781\& Teubner, Stuttgart. [Yes, it's in German.]
1782.Ve
1783.PP
1784.Vb 1
1785\& =item
1786.Ve
1787.PP
1788.Vb 2
1789\& Wirth, Niklaus. 1976. I<Algorithms + Data Structures =
1790\& Programs.> Prentice-Hall, Englewood Cliffs, NJ.
1791.Ve
1792.PP
1793.Vb 1
1794\& =back
1795.Ve
1796.PP
1797.Vb 1
1798\& =end :biblio
1799.Ve
1800.PP
1801Note, however, a "=begin \fIidentifier\fR\*(L"...\*(R"=end \fIidentifier\fR"
1802region where \fIidentifier\fR does \fInot\fR begin with a colon, should not
1803directly contain \*(L"=head1\*(R" ... \*(L"=head4\*(R" commands, nor \*(L"=over\*(R", nor \*(L"=back\*(R",
1804nor \*(L"=item\*(R". For example, this may be considered invalid:
1805.PP
1806.Vb 1
1807\& =begin somedata
1808.Ve
1809.PP
1810.Vb 1
1811\& This is a data paragraph.
1812.Ve
1813.PP
1814.Vb 1
1815\& =head1 Don't do this!
1816.Ve
1817.PP
1818.Vb 1
1819\& This is a data paragraph too.
1820.Ve
1821.PP
1822.Vb 1
1823\& =end somedata
1824.Ve
1825.PP
1826A Pod processor may signal that the above (specifically the \*(L"=head1\*(R"
1827paragraph) is an error. Note, however, that the following should
1828\&\fInot\fR be treated as an error:
1829.PP
1830.Vb 1
1831\& =begin somedata
1832.Ve
1833.PP
1834.Vb 1
1835\& This is a data paragraph.
1836.Ve
1837.PP
1838.Vb 1
1839\& =cut
1840.Ve
1841.PP
1842.Vb 2
1843\& # Yup, this isn't Pod anymore.
1844\& sub excl { (rand() > .5) ? "hoo!" : "hah!" }
1845.Ve
1846.PP
1847.Vb 1
1848\& =pod
1849.Ve
1850.PP
1851.Vb 1
1852\& This is a data paragraph too.
1853.Ve
1854.PP
1855.Vb 1
1856\& =end somedata
1857.Ve
1858.PP
1859And this too is valid:
1860.PP
1861.Vb 1
1862\& =begin someformat
1863.Ve
1864.PP
1865.Vb 1
1866\& This is a data paragraph.
1867.Ve
1868.PP
1869.Vb 1
1870\& And this is a data paragraph.
1871.Ve
1872.PP
1873.Vb 1
1874\& =begin someotherformat
1875.Ve
1876.PP
1877.Vb 1
1878\& This is a data paragraph too.
1879.Ve
1880.PP
1881.Vb 1
1882\& And this is a data paragraph too.
1883.Ve
1884.PP
1885.Vb 1
1886\& =begin :yetanotherformat
1887.Ve
1888.PP
1889.Vb 1
1890\& =head2 This is a command paragraph!
1891.Ve
1892.PP
1893.Vb 1
1894\& This is an ordinary paragraph!
1895.Ve
1896.PP
1897.Vb 1
1898\& And this is a verbatim paragraph!
1899.Ve
1900.PP
1901.Vb 1
1902\& =end :yetanotherformat
1903.Ve
1904.PP
1905.Vb 1
1906\& =end someotherformat
1907.Ve
1908.PP
1909.Vb 1
1910\& Another data paragraph!
1911.Ve
1912.PP
1913.Vb 1
1914\& =end someformat
1915.Ve
1916.PP
1917The contents of the above \*(L"=begin :yetanotherformat\*(R" ...
1918\&\*(L"=end :yetanotherformat\*(R" region \fIaren't\fR data paragraphs, because
1919the immediately containing region's identifier (\*(L":yetanotherformat\*(R")
1920begins with a colon. In practice, most regions that contain
1921data paragraphs will contain \fIonly\fR data paragraphs; however,
1922the above nesting is syntactically valid as Pod, even if it is
1923rare. However, the handlers for some formats, like \*(L"html\*(R",
1924will accept only data paragraphs, not nested regions; and they may
1925complain if they see (targeted for them) nested regions, or commands,
1926other than \*(L"=end\*(R", \*(L"=pod\*(R", and \*(L"=cut\*(R".
1927.PP
1928Also consider this valid structure:
1929.PP
1930.Vb 1
1931\& =begin :biblio
1932.Ve
1933.PP
1934.Vb 1
1935\& Wirth's classic is available in several editions, including:
1936.Ve
1937.PP
1938.Vb 1
1939\& =over
1940.Ve
1941.PP
1942.Vb 1
1943\& =item
1944.Ve
1945.PP
1946.Vb 2
1947\& Wirth, Niklaus. 1975. I<Algorithmen und Datenstrukturen.>
1948\& Teubner, Stuttgart. [Yes, it's in German.]
1949.Ve
1950.PP
1951.Vb 1
1952\& =item
1953.Ve
1954.PP
1955.Vb 2
1956\& Wirth, Niklaus. 1976. I<Algorithms + Data Structures =
1957\& Programs.> Prentice-Hall, Englewood Cliffs, NJ.
1958.Ve
1959.PP
1960.Vb 1
1961\& =back
1962.Ve
1963.PP
1964.Vb 1
1965\& Buy buy buy!
1966.Ve
1967.PP
1968.Vb 1
1969\& =begin html
1970.Ve
1971.PP
1972.Vb 1
1973\& <img src='wirth_spokesmodeling_book.png'>
1974.Ve
1975.PP
1976.Vb 1
1977\& <hr>
1978.Ve
1979.PP
1980.Vb 1
1981\& =end html
1982.Ve
1983.PP
1984.Vb 1
1985\& Now now now!
1986.Ve
1987.PP
1988.Vb 1
1989\& =end :biblio
1990.Ve
1991.PP
1992There, the \*(L"=begin html\*(R"...\*(L"=end html\*(R" region is nested inside
1993the larger \*(L"=begin :biblio\*(R"...\*(L"=end :biblio\*(R" region. Note that the
1994content of the \*(L"=begin html\*(R"...\*(L"=end html\*(R" region is data
1995paragraph(s), because the immediately containing region's identifier
1996(\*(L"html\*(R") \fIdoesn't\fR begin with a colon.
1997.PP
1998Pod parsers, when processing a series of data paragraphs one
1999after another (within a single region), should consider them to
2000be one large data paragraph that happens to contain blank lines. So
2001the content of the above \*(L"=begin html\*(R"...\*(L"=end html\*(R" \fImay\fR be stored
2002as two data paragraphs (one consisting of
2003\&\*(L"<img src='wirth_spokesmodeling_book.png'>\en\*(R"
2004and another consisting of \*(L"<hr>\en\*(R"), but \fIshould\fR be stored as
2005a single data paragraph (consisting of
2006\&\*(L"<img src='wirth_spokesmodeling_book.png'>\en\en<hr>\en\*(R").
2007.PP
2008Pod processors should tolerate empty
2009"=begin \fIsomething\fR\*(L"...\*(R"=end \fIsomething\fR\*(L" regions,
2010empty \*(R"=begin :\fIsomething\fR\*(L"...\*(R"=end :\fIsomething\fR\*(L" regions, and
2011contentless \*(R"=for \fIsomething\fR\*(L" and \*(R"=for :\fIsomething\fR"
2012paragraphs. I.e., these should be tolerated:
2013.PP
2014.Vb 1
2015\& =for html
2016.Ve
2017.PP
2018.Vb 1
2019\& =begin html
2020.Ve
2021.PP
2022.Vb 1
2023\& =end html
2024.Ve
2025.PP
2026.Vb 1
2027\& =begin :biblio
2028.Ve
2029.PP
2030.Vb 1
2031\& =end :biblio
2032.Ve
2033.PP
2034Incidentally, note that there's no easy way to express a data
2035paragraph starting with something that looks like a command. Consider:
2036.PP
2037.Vb 1
2038\& =begin stuff
2039.Ve
2040.PP
2041.Vb 1
2042\& =shazbot
2043.Ve
2044.PP
2045.Vb 1
2046\& =end stuff
2047.Ve
2048.PP
2049There, \*(L"=shazbot\*(R" will be parsed as a Pod command \*(L"shazbot\*(R", not as a data
2050paragraph \*(L"=shazbot\en\*(R". However, you can express a data paragraph consisting
2051of \*(L"=shazbot\en\*(R" using this code:
2052.PP
2053.Vb 1
2054\& =for stuff =shazbot
2055.Ve
2056.PP
2057The situation where this is necessary, is presumably quite rare.
2058.PP
2059Note that =end commands must match the currently open =begin command. That
2060is, they must properly nest. For example, this is valid:
2061.PP
2062.Vb 1
2063\& =begin outer
2064.Ve
2065.PP
2066.Vb 1
2067\& X
2068.Ve
2069.PP
2070.Vb 1
2071\& =begin inner
2072.Ve
2073.PP
2074.Vb 1
2075\& Y
2076.Ve
2077.PP
2078.Vb 1
2079\& =end inner
2080.Ve
2081.PP
2082.Vb 1
2083\& Z
2084.Ve
2085.PP
2086.Vb 1
2087\& =end outer
2088.Ve
2089.PP
2090while this is invalid:
2091.PP
2092.Vb 1
2093\& =begin outer
2094.Ve
2095.PP
2096.Vb 1
2097\& X
2098.Ve
2099.PP
2100.Vb 1
2101\& =begin inner
2102.Ve
2103.PP
2104.Vb 1
2105\& Y
2106.Ve
2107.PP
2108.Vb 1
2109\& =end outer
2110.Ve
2111.PP
2112.Vb 1
2113\& Z
2114.Ve
2115.PP
2116.Vb 1
2117\& =end inner
2118.Ve
2119.PP
2120This latter is improper because when the \*(L"=end outer\*(R" command is seen, the
2121currently open region has the formatname \*(L"inner\*(R", not \*(L"outer\*(R". (It just
2122happens that \*(L"outer\*(R" is the format name of a higher-up region.) This is
2123an error. Processors must by default report this as an error, and may halt
2124processing the document containing that error. A corollary of this is that
2125regions cannot \*(L"overlap\*(R" \*(-- i.e., the latter block above does not represent
2126a region called \*(L"outer\*(R" which contains X and Y, overlapping a region called
2127\&\*(L"inner\*(R" which contains Y and Z. But because it is invalid (as all
2128apparently overlapping regions would be), it doesn't represent that, or
2129anything at all.
2130.PP
2131Similarly, this is invalid:
2132.PP
2133.Vb 1
2134\& =begin thing
2135.Ve
2136.PP
2137.Vb 1
2138\& =end hting
2139.Ve
2140.PP
2141This is an error because the region is opened by \*(L"thing\*(R", and the \*(L"=end\*(R"
2142tries to close \*(L"hting\*(R" [sic].
2143.PP
2144This is also invalid:
2145.PP
2146.Vb 1
2147\& =begin thing
2148.Ve
2149.PP
2150.Vb 1
2151\& =end
2152.Ve
2153.PP
2154This is invalid because every \*(L"=end\*(R" command must have a formatname
2155parameter.
2156.SH "SEE ALSO"
2157.IX Header "SEE ALSO"
2158perlpod, \*(L"PODs: Embedded Documentation\*(R" in perlsyn,
2159podchecker
2160.SH "AUTHOR"
2161.IX Header "AUTHOR"
2162Sean M. Burke