Convert::Wiki::Node - Represents a node in a text


NAME

Convert::Wiki::Node - Represents a node (headline, paragraph etc) in a text


SYNOPSIS

        use Convert::Wiki::Node;
        my $head = Convert::Wiki::Node->new( txt => 'About Foo', type => 'head1' );
        my $text = Convert::Wiki::Node->new( txt => 'Foo is a foobar.', type => 'paragraph' );
        print $head->as_wiki(), $text->as_wiki();


DESCRIPTION

A Convert::Wiki::Node represents a node (headline, paragraph etc) in a text. All the nodes together represent the entire document.


METHODS

error()

        $last_error = $cvt->error();
        $cvt->error($error);                    # set new messags
        $cvt->error('');                        # clear error

Returns the last error message, or '' for no error.

as_wiki()

        my $txt = $node->as_wiki($wiki);

Return the contents of the node as wiki code. The parameter $wiki is the Convert::Wiki object the node belongs to. It can be used to access parameters like interlink.

type()

        my $type = $node->type();

Returns the type of the node as string.

prev()

        my $prev = $node->prev();

Get the node's previous node.

prev_by_type

        my $prev = $node->prev_by_type( $type );

Find a previous node with a certain type, for instance 'head' or 'line'.

next()

        my $next = $node->next();

Get the node's next node.

link()

        $node->link( $other );

Set $node's next node to $other and set $others prev to $node .

_remove_me()

        $rc = $node->_remove_me();

Internally called by Convert::Wiki to fix up the nodes after the first pass. A true return value indicates that this node must be removed entirely.


EXPORT

None by default.


SEE ALSO

the Convert::Wiki manpage.


AUTHOR

Tels http://bloodgate.com


COPYRIGHT AND LICENSE

Copyright (C) 2004 by Tels

This library is free software; you can redistribute it and/or modify it under the terms of the GPL. See the LICENSE file for more details.

 Convert::Wiki::Node - Represents a node in a text