diff options
author | P. J. McDermott <pjm@nac.net> | 2012-08-10 14:29:35 (EDT) |
---|---|---|
committer | P. J. McDermott <pjm@nac.net> | 2012-08-10 14:29:35 (EDT) |
commit | b3fc81396147a4df176cd86cbf0e42e73fdc418f (patch) | |
tree | ef2b607ff63d24e24825649176dfbbd362645c42 /scripts/MarkdownBook/HTMLTree.pm | |
parent | 9a90b5ef3d8f9572838700fa27ec568d29f76d64 (diff) |
Rewrite section code.
Diffstat (limited to 'scripts/MarkdownBook/HTMLTree.pm')
-rw-r--r-- | scripts/MarkdownBook/HTMLTree.pm | 16 |
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; |