You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

36 lines
683 B

package Text::Dokuwiki::Render;
use strict;
use warnings;
use utf8;
sub new {
my ($class) = @_;
my $self = {};
return bless($self, $class);
}
sub treewalk {
my ($self, @tree) = @_;
my $output = "";
foreach my $part (@tree) {
if (ref $part eq 'ARRAY') {
my ($tag, $attrs, @rest) = @{$part};
if ($self->SUPER::can($tag)) {
$output .= $self->$tag($attrs, $self->treewalk(@rest));
} elsif ($self->SUPER::can('default')){
$output .= $self->default($tag, $attrs, $self->treewalk(@rest));
} else {
die("Unimplemented handler for tag: $tag\n");
}
next;
}
$output .= $part;
}
return $output;
}
1;