Pod::Simple::XHTML - Online Linux Manual PageSection : 3
Updated : 2023-01-20
Source : perl v5.36.0
Note : User Contributed Perl Documentation

NAMEPod::Simple::XHTML −− format Pod as validating XHTML

SYNOPSIS​ use Pod::Simple::XHTML; ​ ​ my $parser = Pod::Simple::XHTML−>new(); ​ ​ ... ​ ​ $parser−>parse_file('path/to/file.pod');

DESCRIPTIONThis class is a formatter that takes Pod and renders it as XHTML validating HTML. This is a subclass of Pod::Simple::Methody and inherits all its methods. The implementation is entirely different than Pod::Simple::HTML, but it largely preserves the same interface.

Minimal code​ use Pod::Simple::XHTML; ​ my $psx = Pod::Simple::XHTML−>new; ​ $psx−>output_string(\my $html); ​ $psx−>parse_file('path/to/Module/Name.pm'); ​ open my $out, '>', 'out.html' or die "Cannot open 'out.html': $!\n"; ​ print $out $html; You can also control the character encoding and entities. For example, if you're sure that the POD is properly encoded (using the \*(C`=encoding\*(C'\fR command), you can prevent high-bit characters from being encoded as HTML entities and declare the output character set as UTF−8 before parsing, like so: ​ $psx−>html_charset('UTF−8'); ​ $psx−>html_encode_chars(q{&<>'"});

METHODSPod::Simple::XHTML offers a number of methods that modify the format of the HTML output. Call these after creating the parser object, but before the call to \*(C`parse_file\*(C'\fR: ​ my $parser = Pod::PseudoPod::HTML−>new(); ​ $parser−>set_optional_param("value"); ​ $parser−>parse_file($file);

perldoc_url_prefixIn turning Foo::Bar into http://whatever/Foo%3a%3aBar, what to put before the "Foo%3a%3aBar". The default value is "https://metacpan.org/pod/".

perldoc_url_postfixWhat to put after "Foo%3a%3aBar" in the URL. This option is not set by default.

man_url_prefixIn turning crontab(5) into http://whatever/man/1/crontab, what to put before the "1/crontab". The default value is "http://man.he.net/man".

man_url_postfixWhat to put after "1/crontab" in the URL. This option is not set by default.

title_prefix, title_postfixWhat to put before and after the title in the head. The values should already be &−escaped.

html_css​ $parser−>html_css('path/to/style.css'); The URL or relative path of a CSS file to include. This option is not set by default.

html_javascriptThe URL or relative path of a JavaScript file to pull in. This option is not set by default.

html_doctypeA document type tag for the file. This option is not set by default.

html_charsetThe character set to declare in the Content-Type meta tag created by default for \*(C`html_header_tags\*(C'\fR. Note that this option will be ignored if the value of ​\*(C`html_header_tags\*(C'\fR is changed. Defaults to "ISO\-8859\-1".

html_header_tagsAdditional arbitrary HTML tags for the header of the document. The default value is just a content type header tag: <meta http−equiv="Content−Type" content="text/html; charset=ISO−8859−1"> Add additional meta tags here, or blocks of inline CSS or JavaScript (wrapped in the appropriate tags). html_encode_chars A string containing all characters that should be encoded as HTML entities, specified using the regular expression character class syntax (what you find within brackets in regular expressions). This value will be passed as the second argument to the \*(C`encode_entities\*(C'\fR function of HTML::Entities. If HTML::Entities is not installed, then any characters other than \*(C`&<\*(C'\fR"'> will be encoded numerically.

html_h_levelThis is the level of HTML "Hn" element to which a Pod "head1" corresponds. For example, if \*(C`html_h_level\*(C'\fR is set to 2, a head1 will produce an H2, a head2 will produce an H3, and so on.

default_titleSet a default title for the page if no title can be determined from the content. The value of this string should already be &−escaped.

force_titleForce a title for the page (don't try to determine it from the content). The value of this string should already be &−escaped.

html_header, html_footerSet the HTML output at the beginning and end of each file. The default header includes a title, a doctype tag (if \*(C`html_doctype\*(C'\fR is set), a content tag (customized by \*(C`html_header_tags\*(C'\fR), a tag for a CSS file (if \*(C`html_css\*(C'\fR is set), and a tag for a Javascript file (if ​\*(C`html_javascript\*(C'\fR is set). The default footer simply closes the \f(CW\*(C`html\*(C'\fR and \*(C`body\*(C'\fR tags. The options listed above customize parts of the default header, but setting \*(C`html_header\*(C'\fR or \f(CW\*(C`html_footer\*(C'\fR completely overrides the built-in header or footer. These may be useful if you want to use template tags instead of literal HTML headers and footers or are integrating converted POD pages in a larger website. If you want no headers or footers output in the HTML, set these options to the empty string.

indexWhether to add a table-of-contents at the top of each page (called an index for the sake of tradition).

anchor_itemsWhether to anchor every definition \*(C`=item\*(C'\fR directive. This needs to be enabled if you want to be able to link to specific \*(C`=item\*(C'\fR directives, which are output as \*(C`<dt>\*(C'\fR elements. Disabled by default.

backlinkWhether to turn every =head1 directive into a link pointing to the top of the page (specifically, the opening body tag).

SUBCLASSINGIf the standard options aren't enough, you may want to subclass Pod::Simple::XHMTL. These are the most likely candidates for methods you'll want to override when subclassing.

handle_textThis method handles the body of text within any element: it's the body of a paragraph, or everything between a "=begin" tag and the corresponding "=end" tag, or the text within an L entity, etc. You would want to override this if you are adding a custom element type that does more than just display formatted text. Perhaps adding a way to generate HTML tables from an extended version of POD. So, let's say you want to add a custom element called 'foo'. In your subclass's \*(C`new\*(C'\fR method, after calling \f(CW\*(C`SUPER::new\*(C'\fR you'd call: ​ $new−>accept_targets_as_text( 'foo' ); Then override the \*(C`start_for\*(C'\fR method in the subclass to check for when "$flags−>{'target'}" is equal to 'foo' and set a flag that marks that you're in a foo block (maybe "$self−>{'in_foo'} = 1"). Then override the ​\*(C`handle_text\*(C'\fR method to check for the flag, and pass \f(CW$text\fR to your custom subroutine to construct the HTML output for 'foo' elements, something like: ​ sub handle_text { ​ my ($self, $text) = @_; ​ if ($self−>{'in_foo'}) { ​ $self−>{'scratch'} .= build_foo_html($text); ​ return; ​ } ​ $self−>SUPER::handle_text($text); ​ }

handle_codeThis method handles the body of text that is marked up to be code. You might for instance override this to plug in a syntax highlighter. The base implementation just escapes the text. The callback methods \*(C`start_code\*(C'\fR and \f(CW\*(C`end_code\*(C'\fR emits the \f(CW\*(C`code\*(C'\fR tags before and after \*(C`handle_code\*(C'\fR is invoked, so you might want to override these together with \*(C`handle_code\*(C'\fR if this wrapping isn't suitable. Note that the code might be broken into multiple segments if there are nested formatting codes inside a \*(C`C<...>\*(C'\fR sequence. In between the calls to \*(C`handle_code\*(C'\fR other markup tags might have been emitted in that case. The same is true for verbatim sections if the \*(C`codes_in_verbatim\*(C'\fR option is turned on.

accept_targets_as_htmlThis method behaves like \*(C`accept_targets_as_text\*(C'\fR, but also marks the region as one whose content should be emitted literally, without HTML entity escaping or wrapping in a \*(C`div\*(C'\fR element.

resolve_pod_page_link​ my $url = $pod−>resolve_pod_page_link('Net::Ping', 'INSTALL'); ​ my $url = $pod−>resolve_pod_page_link('perlpodspec'); ​ my $url = $pod−>resolve_pod_page_link(undef, 'SYNOPSIS'); Resolves a POD link target (typically a module or POD file name) and section name to a URL. The resulting link will be returned for the above examples as: ​ https://metacpan.org/pod/Net::Ping#INSTALL ​ https://metacpan.org/pod/perlpodspec ​ #SYNOPSIS Note that when there is only a section argument the URL will simply be a link to a section in the current document.

resolve_man_page_link​ my $url = $pod−>resolve_man_page_link('crontab(5)', 'EXAMPLE CRON FILE'); ​ my $url = $pod−>resolve_man_page_link('crontab'); Resolves a man page link target and numeric section to a URL. The resulting link will be returned for the above examples as: ​ http://man.he.net/man5/crontab ​ http://man.he.net/man1/crontab Note that the first argument is required. The section number will be parsed from it, and if it's missing will default to 1. The second argument is currently ignored, as man.he.net <http://man.he.net> does not currently include linkable IDs or anchor names in its pages. Subclass to link to a different man page HTTP server.

idify​ my $id = $pod−>idify($text); ​ my $hash = $pod−>idify($text, 1); This method turns an arbitrary string into a valid XHTML ID attribute value. The rules enforced, following <http://webdesign.about.com/od/htmltags/a/aa031707.htm>, are: • The id must start with a letter (a−z or A−Z) • All subsequent characters can be letters, numbers (0−9), hyphens (), underscores (_), colons (:), and periods (.). • The final character can't be a hyphen, colon, or period. URLs ending with these characters, while allowed by XHTML, can be awkward to extract from plain text. • Each id must be unique within the document. In addition, the returned value will be unique within the context of the Pod::Simple::XHTML object unless a second argument is passed a true value. ID attributes should always be unique within a single XHTML document, but pass the true value if you are creating not an ID but a URL hash to point to an ID (i.e., if you need to put the "#foo" in \*(C`<a href="#foo">foo</a>\*(C'\fR.

batch_mode_page_object_init​ $pod−>batch_mode_page_object_init($batchconvobj, $module, $infile, $outfile, $depth); Called by Pod::Simple::HTMLBatch so that the class has a chance to initialize the converter. Internally it sets the \*(C`batch_mode\*(C'\fR property to true and sets batch_mode_current_level(), but Pod::Simple::XHTML does not currently use those features. Subclasses might, though.

SEE ALSOPod::Simple, Pod::Simple::Text, Pod::Spell

SUPPORTQuestions or discussion about POD and Pod::Simple should be sent to the pod−people@perl.org mail list. Send an empty email to pod−people−subscribe@perl.org to subscribe. This module is managed in an open GitHub repository, <https://github.com/perl−pod/pod−simple/>. Feel free to fork and contribute, or to clone <git://github.com/perl−pod/pod−simple.git> and send patches! Patches against Pod::Simple are welcome. Please send bug reports to <bug−pod−simple@rt.cpan.org>.

COPYRIGHT AND DISCLAIMERSCopyright (c) 2003−2005 Allison Randal. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.

ACKNOWLEDGEMENTSThanks to Hurricane Electric <http://he.net/> for permission to use its Linux man pages online <http://man.he.net/> site for man page links. Thanks to search.cpan.org <http://search.cpan.org/> for permission to use the site for Perl module links.

AUTHORPod::Simpele::XHTML was created by Allison Randal <allison@perl.org>. Pod::Simple was created by Sean M. Burke <sburke@cpan.org>. But don't bother him, he's retired. Pod::Simple is maintained by: • Allison Randal \*(C`allison@perl.org\*(C'\fR • Hans Dieter Pearcey \*(C`hdp@cpan.org\*(C'\fR • David E. Wheeler \*(C`dwheeler@cpan.org\*(C'\fR
0
Johanes Gumabo
Data Size   :   38,906 byte
man-Pod::Simple::XHTML.3pmBuild   :   2024-12-05, 20:55   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   2 / 170,521
Visitor ID   :     :  
Visitor IP   :   3.147.77.119   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.05
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|249|Pod::Simple::XHTML.3pm|24/25|el══─{─══.|.el══─{─══. ds C` )         (htmlprn|149|Pod::Simple::XHTML.3pm|24/25|.el══─{─══. ds C` |.el══─{─══. ds C` )         (parse_manual_page_|249|Pod::Simple::XHTML.3pm|27|br══─}─══|'br══─}─══ )         (htmlprn|149|Pod::Simple::XHTML.3pm|27|'br══─}─══ |'br══─}─══ )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|96|\*(C`=encoding\*(C'\fR command), |you're sure that the POD is properly encoded (using the \f(CW\*(C`=encoding\*(C'\fR command), )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|108|\*(C`parse_file\*(C'\fR: |the call to \f(CW\*(C`parse_file\*(C'\fR: )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|154|\*(C`html_header_tags\*(C'\fR. Note that this option will be ignored if the value of |for \f(CW\*(C`html_header_tags\*(C'\fR. Note that this option will be ignored if the value of )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|155|\*(C`html_header_tags\*(C'\fR is changed. Defaults to "ISO\-8859\-1". |\&\f(CW\*(C`html_header_tags\*(C'\fR is changed. Defaults to "ISO\-8859\-1". )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|174|\*(C`encode_entities\*(C'\fR function of HTML::Entities. If |second argument to the \f(CW\*(C`encode_entities\*(C'\fR function of HTML::Entities. If )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|175|\*(C`&<\*(C'\fR"'> |HTML::Entities is not installed, then any characters other than \f(CW\*(C`&<\*(C'\fR"'> )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|180|\*(C`html_h_level\*(C'\fR is set to 2, a head1 will produce an H2, a head2 |example, if \f(CW\*(C`html_h_level\*(C'\fR is set to 2, a head1 will produce an H2, a head2 )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|193|\*(C`html_doctype\*(C'\fR is set), a |header includes a title, a doctype tag (if \f(CW\*(C`html_doctype\*(C'\fR is set), a )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|194|\*(C`html_header_tags\*(C'\fR), a tag for a CSS file |content tag (customized by \f(CW\*(C`html_header_tags\*(C'\fR), a tag for a CSS file )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|195|\*(C`html_css\*(C'\fR is set), and a tag for a Javascript file (if |(if \f(CW\*(C`html_css\*(C'\fR is set), and a tag for a Javascript file (if )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|196|\*(C`html_javascript\*(C'\fR is set). The default footer simply closes the \f(CW\*(C`html\*(C'\fR |\&\f(CW\*(C`html_javascript\*(C'\fR is set). The default footer simply closes the \f(CW\*(C`html\*(C'\fR )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|197|\*(C`body\*(C'\fR tags. |and \f(CW\*(C`body\*(C'\fR tags. )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|200|\*(C`html_header\*(C'\fR or \f(CW\*(C`html_footer\*(C'\fR completely overrides the |setting \f(CW\*(C`html_header\*(C'\fR or \f(CW\*(C`html_footer\*(C'\fR completely overrides the )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|213|\*(C`=item\*(C'\fR directive. This needs to be |Whether to anchor every definition \f(CW\*(C`=item\*(C'\fR directive. This needs to be )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|214|\*(C`=item\*(C'\fR directives, which |enabled if you want to be able to link to specific \f(CW\*(C`=item\*(C'\fR directives, which )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|215|\*(C`
\*(C'\fR elements. Disabled by default. |are output as \f(CW\*(C`
\*(C'\fR elements. Disabled by default. )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|235|\*(C`new\*(C'\fR method, after calling \f(CW\*(C`SUPER::new\*(C'\fR you'd call: |subclass's \f(CW\*(C`new\*(C'\fR method, after calling \f(CW\*(C`SUPER::new\*(C'\fR you'd call: )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|241|\*(C`start_for\*(C'\fR method in the subclass to check for when |Then override the \f(CW\*(C`start_for\*(C'\fR method in the subclass to check for when )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|244|\*(C`handle_text\*(C'\fR method to check for the flag, and pass \f(CW$text\fR to your |\&\f(CW\*(C`handle_text\*(C'\fR method to check for the flag, and pass \f(CW$text\fR to your )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|264|\*(C`start_code\*(C'\fR and \f(CW\*(C`end_code\*(C'\fR emits the \f(CW\*(C`code\*(C'\fR tags |The callback methods \f(CW\*(C`start_code\*(C'\fR and \f(CW\*(C`end_code\*(C'\fR emits the \f(CW\*(C`code\*(C'\fR tags )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|265|\*(C`handle_code\*(C'\fR is invoked, so you might want to override these |before and after \f(CW\*(C`handle_code\*(C'\fR is invoked, so you might want to override these )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|266|\*(C`handle_code\*(C'\fR if this wrapping isn't suitable. |together with \f(CW\*(C`handle_code\*(C'\fR if this wrapping isn't suitable. )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|269|\*(C`C<...>\*(C'\fR sequence. In between the |nested formatting codes inside a \f(CW\*(C`C<...>\*(C'\fR sequence. In between the )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|270|\*(C`handle_code\*(C'\fR other markup tags might have been emitted in that |calls to \f(CW\*(C`handle_code\*(C'\fR other markup tags might have been emitted in that )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|271|\*(C`codes_in_verbatim\*(C'\fR |case. The same is true for verbatim sections if the \f(CW\*(C`codes_in_verbatim\*(C'\fR )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|275|\*(C`accept_targets_as_text\*(C'\fR, but also marks the region |This method behaves like \f(CW\*(C`accept_targets_as_text\*(C'\fR, but also marks the region )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|277|\*(C`div\*(C'\fR element. |or wrapping in a \f(CW\*(C`div\*(C'\fR element. )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|342|\*(C`foo\*(C'\fR. |an ID (i.e., if you need to put the "#foo" in \f(CW\*(C`foo\*(C'\fR. )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|350|\*(C`batch_mode\*(C'\fR property to |initialize the converter. Internally it sets the \f(CW\*(C`batch_mode\*(C'\fR property to )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|394|\*(C`allison@perl.org\*(C'\fR |Allison Randal \f(CW\*(C`allison@perl.org\*(C'\fR )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|396|\*(C`hdp@cpan.org\*(C'\fR |Hans Dieter Pearcey \f(CW\*(C`hdp@cpan.org\*(C'\fR )         (rof_escape_sequence|91|Pod::Simple::XHTML.3pm|398|\*(C`dwheeler@cpan.org\*(C'\fR |David E. Wheeler \f(CW\*(C`dwheeler@cpan.org\*(C'\fR )