| Perl6-Pod documentation | view source | Contained in the Perl6-Pod distribution. |
Perl6::Pod::Block::code - Verbatim pre-formatted sample source code
=begin code
print "Ok";
=end code
Code blocks are used to specify pre-formatted text (typically source code), which should be rendered without rejustification, without whitespace-squeezing, and without recognizing any inline formatting codes. Code blocks also have an implicit nesting associated with them. Typically these blocks are used to show examples of code, mark-up, or other textual specifications, and are rendered using a fixed-width font.
A code block may be implicitly specified as one or more lines of text, each of which starts with a whitespace character. The block is terminated by a blank line. For example:
This ordinary paragraph introduces a code block:
$this = 1 * code('block');
$which.is_specified(:by<indenting>);
Implicit code blocks may only be used within =pod, =item, =nested, =END, or semantic blocks.
=code
test code
Render to:
<pre><code>
test code
</code></pre>
=cut
sub to_xhtml { my $self = shift; my $parser = shift; my $el = $parser->mk_element('code')->insert_to( $parser->mk_element('pre') ); $el->add_content( $self->_make_elements($parser,@_) ); }
=code
test code
Render to:
<chapter><programlisting><![CDATA[ test code
]]></programlisting></chapter>
http://zag.ru/perl6-pod/S26.html, Perldoc Pod to HTML converter: http://zag.ru/perl6-pod/, Perl6::Pod::Lib
Zahatski Aliaksandr, <zag@cpan.org>
Copyright (C) 2009-2010 by Zahatski Aliaksandr
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.
| Perl6-Pod documentation | view source | Contained in the Perl6-Pod distribution. |