Commits

Anonymous committed 2602abf

Add the ->append_child() method and replaced it everywhere.

  • Participants
  • Parent commits 500e124

Comments (0)

Files changed (2)

perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Fiction/FromProto/Parser/QnD.pm

             $open->detach_children(),
         );
 
-    $self->_tags_stack->[-1]->append_children([ $new_elem ]);
+    $self->_tags_stack->[-1]->append_child( $new_elem );
 
     $self->_in_para(0);
 
 {
     my ($self, $event) = @_;
 
-    $self->_tags_stack->[-1]->append_children(
-        [ $event->{'elem'} ],
-    );
+    $self->_tags_stack->[-1]->append_child( $event->{'elem'});
 
     return;
 }
 
     if (@{$self->_tags_stack()})
     {
-        $self->_tags_stack->[-1]->append_children([ $new_elem ]);
+        $self->_tags_stack->[-1]->append_child($new_elem);
         return;
     }
     else
     {
         my $text = $self->_consume_up_to(qr{-->});
 
-        $self->_tags_stack->[-1]->append_children(
-            [
-                $self->_new_node({ t => "Comment", text => $text, })
-            ]
+        $self->_tags_stack->[-1]->append_child(
+            $self->_new_node({ t => "Comment", text => $text, })
         );
 
         return 1;

perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Fiction/Struct/Tag.pm

     my ($self, $children) = @_;
 
     push @{$self->children()}, @$children;
+
+    return;
+}
+
+sub append_child
+{
+    my ($self, $child) = @_;
+
+    return $self->append_children( [ $child ] );
 }
 
 sub detach_children
 
 Append more elements to the children.
 
+=head2 $self->append_child($child)
+
+Appends a single child. Uses C<append_children()> .
+
 =head2 my $children = $self->detach_children()
 
 Detaches the children and returns them as an array reference.