Pod::ToDocBook::Pod2xml - Converter POD data to XML::ExtON events.
use XML::ExtOn ('create_pipe'); use Pod::ToDocBook::Pod2xml; my $buf; my $w = new XML::SAX::Writer:: Output => \$buf; my $px = new Pod::ToDocBook::Pod2xml:: header => 0, doctype => 'chapter'; my $p = create_pipe( $px, $w ); $p->parse($text); return $buf; my $px = new Pod::ToDocBook::Pod2xml:: header => 0, doctype => 'chapter', base_id=>'namespace';
=begin, =end, =for
pod:
=begin table params, params some text =end
xml:
<begin params='params, params' name='table'><![CDATA[some text ]]></begin>
=for someformat text
<begin params='' name='someformat'><![CDATA[text ]]>
types:
pod L<text> L<text::test> man L<text(3)> url L<text|http://example.com> L<http://example.com>
Function will construct an element id string. Id string is composed of join (':', $base_id || $parser->{base_id} , $text), where $text in most cases is the pod heading text.
join (':', $base_id || $parser->{base_id} , $text)
$text
The xml id string has strict format. Checkout "cleanup_id" function for specification.
Calls $parser->make_id($text) and checks if such id was already generated. If so, generates new one by adding _i1 (or _i2, i3, ...) to the id string. Return value is new uniq id string.
$parser->make_id($text)
This function is used internally to remove/change any illegal characters from the elements id string. (see http://www.w3.org/TR/2000/REC-xml-20001006#NT-Name for the id string specification)
$id_string =~ s/<!\[CDATA\[(.+?)\]\]>/$1/g; # keep just inside of CDATA $id_string =~ s/<.+?>//g; # remove tags $id_string =~ s/^\s*//; # ltrim spaces $id_string =~ s/\s*$//; # rtrim spaces $id_string =~ tr{/ }{._}; # replace / with . and spaces with _ $id_string =~ s/[^\-_a-zA-Z0-9\.: ]//g; # closed set of characters allowed in id string
In the worst case when the $id_string after clean up will not conform with the specification, warning will be printed out and random number with leading colon will be used.
$id_string
XML::ExtOn, Pod::2::DocBook
Zahatski Aliaksandr, <zag@cpan.org>
Copyright (C) 2009 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.
To install Pod::ToDocBook, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Pod::ToDocBook
CPAN shell
perl -MCPAN -e shell install Pod::ToDocBook
For more information on module installation, please visit the detailed CPAN module installation guide.