Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

318 lines
10 KiB

  1. =head1 NAME
  2. perlpod - plain old documentation
  3. =head1 DESCRIPTION
  4. A pod-to-whatever translator reads a pod file paragraph by paragraph,
  5. and translates it to the appropriate output format. There are
  6. three kinds of paragraphs:
  7. L<verbatim|/"Verbatim Paragraph">,
  8. L<command|/"Command Paragraph">, and
  9. L<ordinary text|/"Ordinary Block of Text">.
  10. =head2 Verbatim Paragraph
  11. A verbatim paragraph, distinguished by being indented (that is,
  12. it starts with space or tab). It should be reproduced exactly,
  13. with tabs assumed to be on 8-column boundaries. There are no
  14. special formatting escapes, so you can't italicize or anything
  15. like that. A \ means \, and nothing else.
  16. =head2 Command Paragraph
  17. All command paragraphs start with "=", followed by an
  18. identifier, followed by arbitrary text that the command can
  19. use however it pleases. Currently recognized commands are
  20. =head1 heading
  21. =head2 heading
  22. =item text
  23. =over N
  24. =back
  25. =cut
  26. =pod
  27. =for X
  28. =begin X
  29. =end X
  30. =over 4
  31. =item =pod
  32. =item =cut
  33. The "=pod" directive does nothing beyond telling the compiler to lay
  34. off parsing code through the next "=cut". It's useful for adding
  35. another paragraph to the doc if you're mixing up code and pod a lot.
  36. =item =head1
  37. =item =head2
  38. Head1 and head2 produce first and second level headings, with the text in
  39. the same paragraph as the "=headn" directive forming the heading description.
  40. =item =over
  41. =item =back
  42. =item =item
  43. Item, over, and back require a little more explanation: "=over" starts a
  44. section specifically for the generation of a list using "=item" commands. At
  45. the end of your list, use "=back" to end it. You will probably want to give
  46. "4" as the number to "=over", as some formatters will use this for indentation.
  47. The unit of indentation is optional. If the unit is not given the natural
  48. indentation of the formatting system applied will be used. Note also that
  49. there are some basic rules to using =item: don't use them outside of
  50. an =over/=back block, use at least one inside an =over/=back block, you don't
  51. _have_ to include the =back if the list just runs off the document, and
  52. perhaps most importantly, keep the items consistent: either use "=item *" for
  53. all of them, to produce bullets, or use "=item 1.", "=item 2.", etc., to
  54. produce numbered lists, or use "=item foo", "=item bar", etc., i.e., things
  55. that looks nothing like bullets or numbers. If you start with bullets or
  56. numbers, stick with them, as many formatters use the first "=item" type to
  57. decide how to format the list.
  58. =item =for
  59. =item =begin
  60. =item =end
  61. For, begin, and end let you include sections that are not interpreted
  62. as pod text, but passed directly to particular formatters. A formatter
  63. that can utilize that format will use the section, otherwise it will be
  64. completely ignored. The directive "=for" specifies that the entire next
  65. paragraph is in the format indicated by the first word after
  66. "=for", like this:
  67. =for html <br>
  68. <p> This is a raw HTML paragraph </p>
  69. The paired commands "=begin" and "=end" work very similarly to "=for", but
  70. instead of only accepting a single paragraph, all text from "=begin" to a
  71. paragraph with a matching "=end" are treated as a particular format.
  72. Here are some examples of how to use these:
  73. =begin html
  74. <br>Figure 1.<IMG SRC="figure1.png"><br>
  75. =end html
  76. =begin text
  77. ---------------
  78. | foo |
  79. | bar |
  80. ---------------
  81. ^^^^ Figure 1. ^^^^
  82. =end text
  83. Some format names that formatters currently are known to accept include
  84. "roff", "man", "latex", "tex", "text", and "html". (Some formatters will
  85. treat some of these as synonyms.)
  86. And don't forget, when using any command, that the command lasts up until
  87. the end of the B<paragraph>, not the line. Hence in the examples below, you
  88. can see the empty lines after each command to end its paragraph.
  89. Some examples of lists include:
  90. =over 4
  91. =item *
  92. First item
  93. =item *
  94. Second item
  95. =back
  96. =over 4
  97. =item Foo()
  98. Description of Foo function
  99. =item Bar()
  100. Description of Bar function
  101. =back
  102. =back
  103. =head2 Ordinary Block of Text
  104. It will be filled, and maybe even
  105. justified. Certain interior sequences are recognized both
  106. here and in commands:
  107. I<text> Italicize text, used for emphasis or variables
  108. B<text> Embolden text, used for switches and programs
  109. S<text> Text contains non-breaking spaces
  110. C<code> Render code in a typewriter font, or give some other
  111. indication that this represents program text
  112. L<name> A link (cross reference) to name
  113. L<name> manual page
  114. L<name/ident> item in manual page
  115. L<name/"sec"> section in other manual page
  116. L<"sec"> section in this manual page
  117. (the quotes are optional)
  118. L</"sec"> ditto
  119. same as above but only 'text' is used for output.
  120. (Text can not contain the characters '/' and '|',
  121. and should contain matched '<' or '>')
  122. L<text|name>
  123. L<text|name/ident>
  124. L<text|name/"sec">
  125. L<text|"sec">
  126. L<text|/"sec">
  127. F<file> Used for filenames
  128. X<index> An index entry
  129. Z<> A zero-width character
  130. E<escape> A named character (very similar to HTML escapes)
  131. E<lt> A literal <
  132. E<gt> A literal >
  133. E<sol> A literal /
  134. E<verbar> A literal |
  135. (these are optional except in other interior
  136. sequences and when preceded by a capital letter)
  137. E<n> Character number n (probably in ASCII)
  138. E<html> Some non-numeric HTML entity, such
  139. as E<Agrave>
  140. Most of the time, you will only need a single set of angle brackets to
  141. delimit the beginning and end of interior sequences. However, sometimes
  142. you will want to put a right angle bracket (or greater-than sign '>')
  143. inside of a sequence. This is particularly common when using a sequence
  144. to provide a different font-type for a snippet of code. As with all
  145. things in Perl, there is more than one way to do it. One way is to
  146. simply escape the closing bracket using an C<E> sequence:
  147. C<$a E<lt>=E<gt> $b>
  148. This will produce: "C<$a E<lt>=E<gt> $b>"
  149. A more readable, and perhaps more "plain" way is to use an alternate set of
  150. delimiters that doesn't require a ">" to be escaped. As of perl5.5.660,
  151. doubled angle brackets ("<<" and ">>") may be used I<if and only if there
  152. is whitespace immediately following the opening delimiter and immediately
  153. preceding the closing delimiter!> For example, the following will do the
  154. trick:
  155. C<< $a <=> $b >>
  156. In fact, you can use as many repeated angle-brackets as you like so
  157. long as you have the same number of them in the opening and closing
  158. delimiters, and make sure that whitespace immediately follows the last
  159. '<' of the opening delimiter, and immediately precedes the first '>' of
  160. the closing delimiter. So the following will also work:
  161. C<<< $a <=> $b >>>
  162. C<<<< $a <=> $b >>>>
  163. This is currently supported by pod2text (Pod::Text), pod2man (Pod::Man),
  164. and any other pod2xxx and Pod::Xxxx translator that uses Pod::Parser
  165. 1.093 or later.
  166. =head2 The Intent
  167. That's it. The intent is simplicity, not power. I wanted paragraphs
  168. to look like paragraphs (block format), so that they stand out
  169. visually, and so that I could run them through fmt easily to reformat
  170. them (that's F7 in my version of B<vi>). I wanted the translator (and not
  171. me) to worry about whether " or ' is a left quote or a right quote
  172. within filled text, and I wanted it to leave the quotes alone, dammit, in
  173. verbatim mode, so I could slurp in a working program, shift it over 4
  174. spaces, and have it print out, er, verbatim. And presumably in a
  175. constant width font.
  176. In particular, you can leave things like this verbatim in your text:
  177. Perl
  178. FILEHANDLE
  179. $variable
  180. function()
  181. manpage(3r)
  182. Doubtless a few other commands or sequences will need to be added along
  183. the way, but I've gotten along surprisingly well with just these.
  184. Note that I'm not at all claiming this to be sufficient for producing a
  185. book. I'm just trying to make an idiot-proof common source for nroff,
  186. TeX, and other markup languages, as used for online documentation.
  187. Translators exist for B<pod2man> (that's for nroff(1) and troff(1)),
  188. B<pod2text>, B<pod2html>, B<pod2latex>, and B<pod2fm>.
  189. =head2 Embedding Pods in Perl Modules
  190. You can embed pod documentation in your Perl scripts. Start your
  191. documentation with a "=head1" command at the beginning, and end it
  192. with a "=cut" command. Perl will ignore the pod text. See any of the
  193. supplied library modules for examples. If you're going to put your
  194. pods at the end of the file, and you're using an __END__ or __DATA__
  195. cut mark, make sure to put an empty line there before the first pod
  196. directive.
  197. __END__
  198. =head1 NAME
  199. modern - I am a modern module
  200. If you had not had that empty line there, then the translators wouldn't
  201. have seen it.
  202. =head2 Common Pod Pitfalls
  203. =over 4
  204. =item *
  205. Pod translators usually will require paragraphs to be separated by
  206. completely empty lines. If you have an apparently empty line with
  207. some spaces on it, this can cause odd formatting.
  208. =item *
  209. Translators will mostly add wording around a LE<lt>E<gt> link, so that
  210. C<LE<lt>foo(1)E<gt>> becomes "the I<foo>(1) manpage", for example (see
  211. B<pod2man> for details). Thus, you shouldn't write things like C<the
  212. LE<lt>fooE<gt> manpage>, if you want the translated document to read
  213. sensibly.
  214. If you need total control of the text used for a link in the output
  215. use the form LE<lt>show this text|fooE<gt> instead.
  216. =item *
  217. The B<podchecker> command is provided to check pod syntax
  218. for errors and warnings. For example, it checks for completely
  219. blank lines in pod segments and for unknown escape sequences.
  220. It is still advised to pass it through
  221. one or more translators and proofread the result, or print out the
  222. result and proofread that. Some of the problems found may be bugs in
  223. the translators, which you may or may not wish to work around.
  224. =back
  225. =head1 SEE ALSO
  226. L<pod2man>, L<perlsyn/"PODs: Embedded Documentation">,
  227. L<podchecker>
  228. =head1 AUTHOR
  229. Larry Wall