Zahatski Aliaksandr > Pod-ToDocBook-0.9 > Pod::ToDocBook::Pod2xml

Download:
Pod-ToDocBook-0.9.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Source  

NAME ^

Pod::ToDocBook::Pod2xml - Converter POD data to XML::ExtON events.

SYNOPSIS ^

    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';

DESCRIPTION ^

Pod::ToDocBook::Pod2xml - Converter POD data to XML::ExtON events.

XML FORMAT ^

parse_link Ltext

types:

    pod
        L<text> 
        L<text::test>
    man
        L<text(3)>

    url
        L<text|http://example.com>
        L<http://example.com>

_make_id($text[, $base_id])

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.

The xml id string has strict format. Checkout "cleanup_id" function for specification.

_make_uniq_id($text)

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.

_cleanup_id($id_string)

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.

SEE ALSO ^

XML::ExtOn, Pod::2::DocBook

AUTHOR ^

Zahatski Aliaksandr, <zag@cpan.org>

COPYRIGHT AND LICENSE ^

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.

syntax highlighting: