This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
testcase for change #27832
[perl5.git] / lib / Pod / t / basic.man
1 .SH "NAME"
2 basic.pod \- Test of various basic POD features in translators.
3 .SH "HEADINGS"
4 .IX Header "HEADINGS"
5 Try a few different levels of headings, with embedded formatting codes and
6 other interesting bits.
7 .ie n .SH "This ""is"" a ""level 1"" heading"
8 .el .SH "This \f(CWis\fP a ``level 1'' heading"
9 .IX Header "This is a level 1 heading"
10 .Sh "``Level'' ""2 \fIheading\fP"
11 .IX Subsection "``Level'' ""2 heading"
12 \fILevel 3 \f(BIheading \f(BIwith \f(CB\*(C`weird \f(CBstuff "" (double quote)\f(CB\*(C'\f(BI\f(BI\fI\fR
13 .IX Subsection "Level 3 heading with weird stuff """" (double quote)"
14 .PP
15 Level "4 \f(CW\*(C`heading\*(C'\fR
16 .IX Subsection "Level ""4 heading"
17 .PP
18 Now try again with \fBintermixed\fR \fItext\fR.
19 .ie n .SH "This ""is"" a ""level 1"" heading"
20 .el .SH "This \f(CWis\fP a ``level 1'' heading"
21 .IX Header "This is a level 1 heading"
22 Text.
23 .Sh "``Level'' 2 \fIheading\fP"
24 .IX Subsection "``Level'' 2 heading"
25 Text.
26 .PP
27 \fILevel 3 \f(BIheading \f(BIwith \f(CB\*(C`weird \f(CBstuff\f(CB\*(C'\f(BI\f(BI\fI\fR
28 .IX Subsection "Level 3 heading with weird stuff"
29 .PP
30 Text.
31 .PP
32 Level "4 \f(CW\*(C`heading\*(C'\fR
33 .IX Subsection "Level ""4 heading"
34 .PP
35 Text.
36 .SH "LINKS"
37 .IX Header "LINKS"
38 These are all taken from the Pod::Parser tests.
39 .PP
40 Try out \fI\s-1LOTS\s0\fR of different ways of specifying references:
41 .PP
42 Reference the \*(L"section\*(R" in manpage
43 .PP
44 Reference the \*(L"section\*(R" in \*(L"manpage\*(R"
45 .PP
46 Reference the \*(L"section\*(R" in manpage
47 .PP
48 Now try it using the new \*(L"|\*(R" stuff ...
49 .PP
50 Reference the thistext|
51 .PP
52 Reference the thistext |
53 .PP
54 Reference the thistext|
55 .PP
56 Reference the thistext |
57 .PP
58 Reference the thistext|
59 .PP
60 Reference the thistext|
61 .PP
62 And then throw in a few new ones of my own.
63 .PP
64 foo
65 .PP
66 foo
67 .PP
68 \&\*(L"bar\*(R" in foo
69 .PP
70 \&\*(L"baz boo\*(R" in foo
71 .PP
72 \&\*(L"bar\*(R"
73 .PP
74 \&\*(L"baz boo\*(R"
75 .PP
76 \&\*(L"baz boo\*(R"
77 .PP
78 \&\*(L"baz boo\*(R" in foo bar
79 .PP
80 \&\*(L"boo var baz\*(R"
81 .PP
82 \&\*(L"bar baz\*(R"
83 .PP
84 \&\*(L"boo\*(R", \*(L"bar\*(R", and \*(L"baz\*(R"
85 .PP
86 foobar
87 .PP
88 Testing \fIitalics\fR
89 .PP
90 "\fIItalic\fR text" in foo
91 .PP
92 "Section \f(CW\*(C`with\*(C'\fR \fI\f(BIother\fI markup\fR" in foo|bar
93 .PP
94 Nested <http://www.perl.org/>
95 .SH "OVER AND ITEMS"
96 .IX Header "OVER AND ITEMS"
97 Taken from Pod::Parser tests, this is a test to ensure that multiline
98 =item paragraphs get indented appropriately.
99 .IP "This is a test." 4
100 .IX Item "This is a test."
101 .PP
102 There should be whitespace now before this line.
103 .PP
104 Taken from Pod::Parser tests, this is a test to ensure the nested =item
105 paragraphs get indented appropriately.
106 .IP "1." 2
107 First section.
108 .RS 2
109 .IP "a" 2
110 .IX Item "a"
111 this is item a
112 .IP "b" 2
113 .IX Item "b"
114 this is item b
115 .RE
116 .RS 2
117 .RE
118 .IP "2." 2
119 Second section.
120 .RS 2
121 .IP "a" 2
122 .IX Item "a"
123 this is item a
124 .IP "b" 2
125 .IX Item "b"
126 this is item b
127 .IP "c" 2
128 .IX Item "c"
129 .PD 0
130 .IP "d" 2
131 .IX Item "d"
132 .PD
133 This is item c & d.
134 .RE
135 .RS 2
136 .RE
137 .PP
138 Now some additional weirdness of our own.  Make sure that multiple tags
139 for one paragraph are properly compacted.
140 .ie n .IP """foo""" 4
141 .el .IP "``foo''" 4
142 .IX Item "foo"
143 .PD 0
144 .IP "\fBbar\fR" 4
145 .IX Item "bar"
146 .ie n .IP """baz""" 4
147 .el .IP "\f(CWbaz\fR" 4
148 .IX Item "baz"
149 .PD
150 There shouldn't be any spaces between any of these item tags; this idiom
151 is used in perlfunc.
152 .IP "Some longer item text" 4
153 .IX Item "Some longer item text"
154 Just to make sure that we test paragraphs where the item text doesn't fit
155 in the margin of the paragraph (and make sure that this paragraph fills a
156 few lines).
157 .Sp
158 Let's also make it multiple paragraphs to be sure that works.
159 .PP
160 Test use of =over without =item as a block \*(L"quote\*(R" or block paragraph.
161 .Sp
162 .RS 4
163 This should be indented four spaces but otherwise formatted the same as
164 any other regular text paragraph.  Make sure it's long enough to see the
165 results of the formatting.....
166 .RE
167 .PP
168 Now try the same thing nested, and make sure that the indentation is reset
169 back properly.
170 .RS 4
171 .Sp
172 .RS 4
173 This paragraph should be doubly indented.
174 .RE
175 .RE
176 .RS 4
177 .Sp
178 This paragraph should only be singly indented.
179 .IP "\(bu" 4
180 This is an item in the middle of a block\-quote, which should be allowed.
181 .IP "\(bu" 4
182 We're also testing tagless item commands.
183 .RE
184 .RS 4
185 .Sp
186 Should be back to the single level of indentation.
187 .RE
188 .PP
189 Should be back to regular indentation.
190 .PP
191 Now also check the transformation of * into real bullets for man pages.
192 .IP "\(bu" 4
193 An item.  We're also testing using =over without a number, and making sure
194 that item text wraps properly.
195 .IP "\(bu" 4
196 Another item.
197 .PP
198 and now test the numbering of item blocks.
199 .IP "1." 4
200 First item.
201 .IP "2." 4
202 Second item.
203 .SH "FORMATTING CODES"
204 .IX Header "FORMATTING CODES"
205 Another test taken from Pod::Parser.
206 .PP
207 This is a test to see if I can do not only \f(CW$self\fR and \f(CW\*(C`method()\*(C'\fR, but
208 also \f(CW\*(C`$self\->method()\*(C'\fR and \f(CW\*(C`$self\->{FIELDNAME}\*(C'\fR and
209 \&\f(CW\*(C`$Foo <=> $Bar\*(C'\fR without resorting to escape sequences. If 
210 I want to refer to the right-shift operator I can do something
211 like \f(CW\*(C`$x >> 3\*(C'\fR or even \f(CW\*(C`$y >> 5\*(C'\fR.
212 .PP
213 Now for the grand finale of \f(CW\*(C`$self\->method()\->{FIELDNAME} = {FOO=>BAR}\*(C'\fR.
214 And I also want to make sure that newlines work like this
215 \&\f(CW\*(C`$self\->{FOOBAR} >> 3 and [$b => $a]\->[$a <=> $b]\*(C'\fR
216 .PP
217 Of course I should still be able to do all this \fIwith\fR escape sequences
218 too: \f(CW\*(C`$self\->method()\*(C'\fR and \f(CW\*(C`$self\->{FIELDNAME}\*(C'\fR and
219 \&\f(CW\*(C`{FOO=>BAR}\*(C'\fR.
220 .PP
221 Dont forget \f(CW\*(C`$self\->method()\->{FIELDNAME} = {FOO=>BAR}\*(C'\fR.
222 .PP
223 And make sure that \f(CW0\fR works too!
224 .PP
225 Now, if I use << or >> as my delimiters, then I have to use whitespace.
226 So things like \f(CW\*(C`<$self\-\*(C'\fR\fImethod()\fR>> and \f(CW\*(C`<$self\-\*(C'\fR{\s-1FIELDNAME\s0}>> wont end
227 up doing what you might expect since the first > will still terminate
228 the first < seen.
229 .PP
230 Lets make sure these work for empty ones too, like \f(CW\*(C`\*(C'\fR and \f(CW\*(C`>>\*(C'\fR
231 (just to be obnoxious)
232 .PP
233 The statement: \f(CW\*(C`This is dog kind's \f(CIfinest\f(CW hour!\*(C'\fR is a parody of a
234 quotation from Winston Churchill.
235 .PP
236 The following tests are added to those:
237 .PP
238 Make sure that a few other odd \fIthings\fR still work.  This should be
239 a vertical bar:  |.  Here's a test of a few more special escapes
240 that have to be supported:
241 .IP "&" 3
242 An ampersand.
243 .IP "'" 3
244 An apostrophe.
245 .IP "<" 3
246 A less-than sign.
247 .IP ">" 3
248 A greater-than sign.
249 .IP """" 3
250 A double quotation mark.
251 .IP "/" 3
252 A forward slash.
253 .PP
254 Try to get this bit of text over towards the edge so |that\ all\ of\ this\ text\ inside\ S<>\ won't| be wrapped.  Also test the
255 |same\ thing\ with\ non-breaking\ spaces.|
256 .PP
257 There is a soft hy\%phen in hyphen at hy\-phen.
258 .PP
259 This is a test of an index entry.
260 .IX Xref "index entry"
261 .SH "VERBATIM"
262 .IX Header "VERBATIM"
263 Throw in a few verbatim paragraphs.
264 .PP
265 .Vb 8
266 \&    use Term::ANSIColor;
267 \&    print color 'bold blue';
268 \&    print "This text is bold blue.\en";
269 \&    print color 'reset';
270 \&    print "This text is normal.\en";
271 \&    print colored ("Yellow on magenta.\en", 'yellow on_magenta');
272 \&    print "This text is normal.\en";
273 \&    print colored ['yellow on_magenta'], "Yellow on magenta.\en";
274 \&
275 \&    use Term::ANSIColor qw(uncolor);
276 \&    print uncolor '01;31', "\en";
277 .Ve
278 .PP
279 But this isn't verbatim (make sure it wraps properly), and the next
280 paragraph is again:
281 .PP
282 .Vb 2
283 \&    use Term::ANSIColor qw(:constants);
284 \&    print BOLD, BLUE, "This text is in bold blue.\en", RESET;
285 \&
286 \&    use Term::ANSIColor qw(:constants); $Term::ANSIColor::AUTORESET = 1; print BOLD BLUE "This text is in bold blue.\en"; print "This text is normal.\en";
287 .Ve
288 .PP
289 (Ugh, that's obnoxiously long.)  Try different spacing:
290 .PP
291 .Vb 7
292 \&        Starting with a tab.
293 \&Not
294 \&starting
295 \&with
296 \&a
297 \&tab.  But this should still be verbatim.
298 \& As should this.
299 .Ve
300 .PP
301 This isn't.
302 .PP
303 .Vb 2
304 \& This is.  And this:    is an internal tab.  It should be:
305 \&                    |\-\-| <= lined up with that.
306 .Ve
307 .PP
308 (Tricky, but tabs should be expanded before the translator starts in on
309 the text since otherwise text with mixed tabs and spaces will get messed
310 up.)
311 .PP
312 .Vb 5
313 \&    And now we test verbatim paragraphs right before a heading.  Older
314 \&    versions of Pod::Man generated two spaces between paragraphs like this
315 \&    and the heading.  (In order to properly test this, one may have to
316 \&    visually inspect the nroff output when run on the generated *roff
317 \&    text, unfortunately.)
318 .Ve
319 .SH "CONCLUSION"
320 .IX Header "CONCLUSION"
321 That's all, folks!