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