Skip to content

Commit 46262ea

Browse files
authored
Merge pull request #2496 from finanalyst/master
formating codes in pod
2 parents 03d2657 + cbd16fe commit 46262ea

File tree

1 file changed

+155
-1
lines changed

1 file changed

+155
-1
lines changed

doc/Language/pod.pod6

Lines changed: 155 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,9 @@ angle brackets; Unicode double angle brackets may be used.
451451
452452
Formatting codes may nest other formatting codes.
453453
454+
The following codes are available: B<B>, B<C>, B<E>, B<I>, B<K>, B<L>, B<N>, B<P>,
455+
B<R>, B<T>, B<U>, B<V>, B<X>, and B<Z>.
456+
454457
=head2 Bold
455458
456459
To format a text in bold enclose it in C<B< >>
@@ -517,6 +520,64 @@ Comments L<#Comments>
517520
518521
L<Comments|#Comments>
519522
523+
=head2 Placement links
524+
525+
This code is not implemented in C<Pod::To::HTML>, but is partially implemented in C<Pod::To::BigPage>.
526+
527+
A second kind of linkE<mdash>the C<P<>> or B<placement link>E<mdash>works
528+
in the opposite direction. Instead of directing focus out to another
529+
document, it allows you to assimilate the contents of another document
530+
into your own.
531+
532+
In other words, the C<P<>> formatting code takes a URI and (where possible)
533+
inserts the contents of the corresponding document inline in place of the
534+
code itself.
535+
536+
C<P<>> codes are handy for breaking out standard elements of
537+
your documentation set into reusable components that can then be
538+
incorporated directly into multiple documents. For example:
539+
540+
=COPYRIGHT
541+
C<P><file:/shared/docs/std_copyright.pod>
542+
543+
=DISCLAIMER
544+
C<P><http://www.MegaGigaTeraPetaCorp.com/std/disclaimer.txt>
545+
546+
might produce:
547+
548+
=begin nested
549+
B<Copyright>
550+
551+
This document is copyright (c) MegaGigaTeraPetaCorp, 2006. All rights reserved.
552+
553+
B<Disclaimer>
554+
555+
ABSOLUTELY NO WARRANTY IS IMPLIED. NOT EVEN OF ANY KIND. WE HAVE SOLD
556+
YOU THIS SOFTWARE WITH NO HINT OF A SUGGESTION THAT IT IS EITHER USEFUL
557+
OR USABLE. AS FOR GUARANTEES OF CORRECTNESS...DON'T MAKE US LAUGH! AT
558+
SOME TIME IN THE FUTURE WE MIGHT DEIGN TO SELL YOU UPGRADES THAT PURPORT
559+
TO ADDRESS SOME OF THE APPLICATION'S MANY DEFICIENCIES, BUT NO PROMISES
560+
THERE EITHER. WE HAVE MORE LAWYERS ON STAFF THAN YOU HAVE TOTAL
561+
EMPLOYEES, SO DON'T EVEN *THINK* ABOUT SUING US. HAVE A NICE DAY.
562+
=end nested
563+
564+
If a renderer cannot find or access the external data source for a
565+
placement link, it must issue a warning and render the URI directly in
566+
some form, possibly as an outwards link. For example:
567+
568+
=begin nested
569+
B<Copyright>
570+
571+
See: L<std_copyright.pod|file:/shared/docs/std_copyright.pod>
572+
573+
B<Disclaimer>
574+
575+
See: L<http://www.MegaGigaTeraPetaCorp.com/std/disclaimer.txt>
576+
=end nested
577+
578+
You can use any of the following URI forms (see L<#Links>) in a
579+
placement link.
580+
520581
=head2 Comments
521582
522583
A comment is text that is never rendered.
@@ -545,6 +606,28 @@ Enter your name K<John Doe>
545606
546607
Z<If used will bust Pod::To::BigPage>
547608
609+
=head2 Replaceable
610+
611+
The C<R<>> formatting code specifies that the contained text is a
612+
B<replaceable item>, a placeholder, or a metasyntactic variable. It is
613+
used to indicate a component of a syntax or specification that should
614+
eventually be replaced by an actual value. For example:
615+
616+
=begin code :allow<B>
617+
The basic C<ln> command is: C<ln> B<R<source_file> R<target_file>>
618+
=end code
619+
620+
or:
621+
622+
=begin code :allow<B>
623+
Then enter your details at the prompt:
624+
625+
=for input
626+
Name: B<R<your surname>>
627+
ID: B<R<your employee number>>
628+
Pass: B<R<your 36-letter password>>
629+
=end code
630+
548631
=head2 Terminal output
549632
550633
To flag text as terminal output enclose it in C<T< >>
@@ -576,6 +659,77 @@ Perl 6 makes considerable use of the E<0xAB> and E<0xBB> characters.
576659
577660
Perl 6 makes considerable use of the « and » characters.
578661
662+
=head2 Verbatim text
663+
664+
This code is not implemented by C<Pod::To::HTML>, but is implemented in C<Pod::To::BigPage>.
665+
666+
The C<V<>> formatting code treats its entire contents as being B<verbatim>,
667+
disregarding every apparent formatting code within it. For example:
668+
669+
The B<V< V<> >> formatting code disarms other codes
670+
such as V< I<>, C<>, B<>, and M<> >.
671+
672+
Note, however that the C<V<>> code only changes the way its
673+
contents are parsed, I<not> the way they are rendered. That is, the
674+
contents are still wrapped and formatted like plain text, and the
675+
effects of any formatting codes surrounding the C<V<>> code
676+
are still applied to its contents. For example the previous example
677+
is rendered:
678+
679+
=nested
680+
The B<V< V<> >> formatting code disarms other codes
681+
such as V< I<>, C<>, B<>, and M<> >.
682+
683+
=head2 Indexing terms
684+
685+
Anything enclosed in an C<X<>> code is an B<index entry>. The contents
686+
of the code are both formatted into the document and used as the
687+
(case-insensitive) index entry:
688+
689+
=begin code :allow<B>
690+
An B<X<array>> is an ordered list of scalars indexed by number,
691+
starting with 0. A B<X<hash>> is an unordered collection of scalar
692+
values indexed by their associated string key.
693+
=end code
694+
695+
You can specify an index entry in which the indexed text and the index
696+
entry are different, by separating the two with a vertical bar:
697+
698+
=begin code :allow<B>
699+
An B<X<array|arrays>> is an ordered list of scalars indexed by number,
700+
starting with 0. A B<X<hash|hashes>> is an unordered collection of
701+
scalar values indexed by their associated string key.
702+
=end code
703+
704+
In the two-part form, the index entry comes after the bar and is
705+
case-sensitive.
706+
707+
You can specify hierarchical index entries by separating indexing levels
708+
with commas:
709+
710+
=begin code :allow<B>
711+
An X<array|B<arrays, definition of>> is an ordered list of scalars
712+
indexed by number, starting with 0. A X<hash|B<hashes, definition of>>
713+
is an unordered collection of scalar values indexed by their
714+
associated string key.
715+
=end code
716+
717+
You can specify two or more entries for a single indexed text, by separating
718+
the entries with semicolons:
719+
720+
=begin code :allow<B>
721+
A X<hash|B<hashes, definition of; associative arrays>>
722+
is an unordered collection of scalar values indexed by their
723+
associated string key.
724+
=end code
725+
726+
The indexed text can be empty, creating a "zero-width" index entry:
727+
728+
=begin code :allow<B>
729+
B<X<|puns, deliberate>>This is called the "Orcish Manoeuvre"
730+
because you "OR" the "cache".
731+
=end code
732+
579733
=head1 Rendering Pod
580734
581735
=head2 HTML
@@ -673,4 +827,4 @@ Pod::Heading.new(level => 2, config => {}, contents => [Pod::Block::Para.new(con
673827
Pod::Block::Para.new(config => {}, contents => ["Here some text for the subsection."]);
674828
=end pod
675829

676-
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6
830+
# vim: expandtab softtabstop=4 shiftwidth=4 ft=perl6

0 commit comments

Comments
 (0)