summaryrefslogtreecommitdiffstats
path: root/scripts/MarkdownBook/HTMLTree.pm
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/MarkdownBook/HTMLTree.pm')
-rw-r--r--scripts/MarkdownBook/HTMLTree.pm16
1 files changed, 8 insertions, 8 deletions
diff --git a/scripts/MarkdownBook/HTMLTree.pm b/scripts/MarkdownBook/HTMLTree.pm
index 27db3e1..419eb53 100644
--- a/scripts/MarkdownBook/HTMLTree.pm
+++ b/scripts/MarkdownBook/HTMLTree.pm
@@ -43,30 +43,30 @@ sub find_elements_by_tag_names
sub each_text
{
- my ($code, $elem, @args) = @_;
+ my ($elem) = @_;
my $child = $elem;
my $root = $elem;
- _each_text_recursive($code, $child, $root, @args);
+ return _each_text_recursive($child, $root);
}
sub _each_text_recursive
{
- my ($code, $elem, $root, @args) = @_;
+ my ($elem, $root) = @_;
my $child;
- my $i = -1;
+ my @retlist = ();
foreach $child ($elem->content_list()) {
- ++$i;
if (ref($_) eq 'HTML::Element') {
- _each_text_recursive($code, $child, $root, @args);
+ push(@retlist, _each_text_recursive($child, $root));
} else {
- $code->(\$root, $child, @args);
- $elem->splice_content($i, 1, $child);
+ push(@retlist, $child);
}
}
+
+ return @retlist;
}
1;