| Perl6-Pod documentation | Contained in the Perl6-Pod distribution. |
Perl6::Pod::FormattingCode::C - Contained text is code
=para
Use C<=config> for this or C<< $i > 4 >>;
The C<> formatting code specifies that the contained text is code; that is, something that might appear in a program or specification. Such content would typically be rendered in a fixed-width font (preferably a different font from that used for the T<> or K<> formatting codes) or with <samp>...</samp> tags. The contents of a C<> code are space-preserved and verbatim. The C<> code is the inline equivalent of the =code block.
To include other formatting codes in a C<> code, you can lexically reconfigure it:
=begin para
=config C<> :allow<E I>
Perl 6 makes extensive use of the C<E<laquo>> and C<E<raquo>>
characters, for example, in a hash look-up:
C<%hashI<E<laquo>>keyI<E<raquo>>>
=end para
To enable entities in every C<...> put a =config C<>> :allowC<E> at the top of the document
Exported :
<code></code>
<code></code>
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 | Contained in the Perl6-Pod distribution. |
package Perl6::Pod::FormattingCode::C; #$Id$
use Perl6::Pod::FormattingCode; use base 'Perl6::Pod::FormattingCode'; use strict; use warnings; sub to_xhtml { my $self = shift; my $parser = shift; my $el = # $parser->mk_element('code')->add_content( $parser->_make_elements(@_) ); $parser->mk_element('code')->add_content( $self->_make_elements($parser,@_) ); return $el; } sub to_docbook { my $self = shift; return $self->to_xhtml(@_) } #add escaping sub _make_elements { my $self = shift; my $parser = shift; my @res = (); for (@_) { push @res, ref($_) ? ref($_) eq 'ARRAY' ? $parser->_make_elements(@$_) : $_ : $parser->mk_characters(_html_escape($_)); } return @res; } sub _html_escape { my ( $txt ) =@_; $txt =~ s/&/&/g; $txt =~ s/</</g; $txt =~ s/>/>/g; # $txt =~ s/"/"/g; # $txt =~ s/'/'/g; $txt } 1; __END__