texinfo-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: * tp/Texinfo/ParserNonXS.pm (_close_container), t


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/ParserNonXS.pm (_close_container), tp/Texinfo/XS/parsetexi/close.c (close_container): keep before_item type even if it contains only source marks, as a before_item signals in gather_previous_item that there is no need to add an empty table definition.
Date: Sat, 04 Feb 2023 13:33:56 -0500

This is an automated email from the git hooks/post-receive script.

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new dbf925f71c * tp/Texinfo/ParserNonXS.pm (_close_container), 
tp/Texinfo/XS/parsetexi/close.c (close_container): keep before_item type even 
if it contains only source marks, as a before_item signals in 
gather_previous_item that there is no need to add an empty table definition.
dbf925f71c is described below

commit dbf925f71c604b080dc55cdc4571172073c33bb4
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Sat Feb 4 19:29:31 2023 +0100

    * tp/Texinfo/ParserNonXS.pm (_close_container),
    tp/Texinfo/XS/parsetexi/close.c (close_container): keep before_item
    type even if it contains only source marks, as a before_item signals
    in gather_previous_item that there is no need to add an empty table
    definition.
    
    * tp/Texinfo/ParserNonXS.pm (_close_command_cleanup),
    tp/Texinfo/XS/parsetexi/close.c (close_command_cleanup): keep a
    before_item even if it is empty if it contains a source mark.
    
    * tp/Texinfo/ParserNonXS.pm (_gather_previous_item): check the
    length of added contents for table definition and for table term
    and add contents only if there is some.
    
    * tp/Texinfo/ParserNonXS.pm (_close_command_cleanup): do not
    autovivify an empty contents for before_item.
    
    * tp/t/22xtable.t, tp/Makefile.tres: add empty_table for a regular
    empty @table.
    
    * tp/t/60macro.t, tp/Makefile.tres: add tests with macro expansion in
    empty before_item, for @table and @multitable, and with empty
    table/multitable and not empty.
---
 ChangeLog                                          |  26 ++
 tp/Makefile.tres                                   |   5 +
 tp/TODO                                            |   5 +-
 tp/Texinfo/ParserNonXS.pm                          |  82 +++---
 tp/Texinfo/XS/parsetexi/close.c                    |  18 +-
 tp/t/22xtable.t                                    |   4 +
 tp/t/60macro.t                                     |  30 +++
 .../macro_in_empty_multitable_empty_before_item.pl | 214 ++++++++++++++++
 .../macro_in_empty_table_empty_before_item.pl      | 192 ++++++++++++++
 .../macro/macro_in_multitable_empty_before_item.pl | 285 +++++++++++++++++++++
 .../macro/macro_in_table_empty_before_item.pl      | 238 +++++++++++++++++
 tp/t/results/xtable/empty_table.pl                 | 119 +++++++++
 12 files changed, 1171 insertions(+), 47 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 92b06bcf3b..8e65d3a4eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2023-02-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/ParserNonXS.pm (_close_container),
+       tp/Texinfo/XS/parsetexi/close.c (close_container): keep before_item
+       type even if it contains only source marks, as a before_item signals
+       in gather_previous_item that there is no need to add an empty table
+       definition.
+
+       * tp/Texinfo/ParserNonXS.pm (_close_command_cleanup),
+       tp/Texinfo/XS/parsetexi/close.c (close_command_cleanup): keep a
+       before_item even if it is empty if it contains a source mark.
+
+       * tp/Texinfo/ParserNonXS.pm (_gather_previous_item): check the
+       length of added contents for table definition and for table term
+       and add contents only if there is some.
+
+       * tp/Texinfo/ParserNonXS.pm (_close_command_cleanup): do not
+       autovivify an empty contents for before_item.
+
+       * tp/t/22xtable.t, tp/Makefile.tres: add empty_table for a regular
+       empty @table.
+
+       * tp/t/60macro.t, tp/Makefile.tres: add tests with macro expansion in
+       empty before_item, for @table and @multitable, and with empty
+       table/multitable and not empty.
+
 2023-02-04  Gavin Smith <gavinsmith0123@gmail.com>
 
        Basic inline context for line args
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 00f8844bdf..d376943ae3 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -1202,6 +1202,8 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/macro/macro_imbricated_with_beginning_command_name.pl \
   t/results/macro/macro_in_accent.pl \
   t/results/macro/macro_in_brace_command.pl \
+  t/results/macro/macro_in_empty_multitable_empty_before_item.pl \
+  t/results/macro/macro_in_empty_table_empty_before_item.pl \
   t/results/macro/macro_in_end_argument.pl \
   t/results/macro/macro_in_ifset.pl \
   t/results/macro/macro_in_ifset_end_in_arg.pl \
@@ -1211,6 +1213,8 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/macro/macro_in_macro_arg_simpler.pl \
   t/results/macro/macro_in_menu.pl \
   t/results/macro/macro_in_misc_commands.pl \
+  t/results/macro/macro_in_multitable_empty_before_item.pl \
+  t/results/macro/macro_in_table_empty_before_item.pl \
   t/results/macro/macro_name_with_digit.pl \
   t/results/macro/macro_name_with_hyphen.pl \
   t/results/macro/macro_no_arg_bad_expansion.pl \
@@ -1793,6 +1797,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/xtable/comment_and_itemx_before_item.pl \
   t/results/xtable/definfoenclose_on_table_line.pl \
   t/results/xtable/empty_item_itemx.pl \
+  t/results/xtable/empty_table.pl \
   t/results/xtable/headitem_in_table.pl \
   t/results/xtable/index_command_before_end_table.pl \
   t/results/xtable/inter_item_commands_in_table.pl \
diff --git a/tp/TODO b/tp/TODO
index 1e24993eb7..97e58c7f82 100644
--- a/tp/TODO
+++ b/tp/TODO
@@ -17,10 +17,7 @@ or value expansion. aliases.
 done: source_marks structures, with beginning and end of included file, @
 protecting end of line in @def*, @setfilename in included files.
 
-Fix
-# FIXME this is wrong, the source mark ends up at a wrong location
-
-# FIXME need a test for a container other than preformatted
+# TODO add test with type different from before_item and preformatted
 
 check that there is a test of something like
 @macro cpfn
diff --git a/tp/Texinfo/ParserNonXS.pm b/tp/Texinfo/ParserNonXS.pm
index 2a0ef6e8ab..a671b39ae0 100644
--- a/tp/Texinfo/ParserNonXS.pm
+++ b/tp/Texinfo/ParserNonXS.pm
@@ -1684,9 +1684,11 @@ sub _close_container($$)
   if (_is_container_empty($current)) {
     if ($current->{'source_marks'}
         and scalar(@{$current->{'source_marks'}})) {
-      # keep the element to keep the source mark, but remove the type.
-      # FIXME need a test for a container other than preformatted
-      delete $current->{'type'};
+      # Keep the element to keep the source mark, but remove some types.
+      # Keep before_item in order not to add empty table definition in
+      # gather_previous_item.
+      # TODO add test with type different from before_item and preformatted
+      delete $current->{'type'} if ($current->{'type'} ne 'before_item');
     } else {
       $element_to_remove = $current;
     }
@@ -1807,17 +1809,21 @@ sub _gather_previous_item($$;$$)
   }
   $splice_idx2 = $contents_count if !defined($splice_idx2);
 
-  my $new_contents = [];
-  @{$new_contents} = splice @{$current->{'contents'}},
-                            $splice_idx, $splice_idx2 - $splice_idx;
-  my $table_after_terms = {'type' => $type,
+  my $table_after_terms;
+  if ($splice_idx2 - $splice_idx) {
+    my $new_contents = [];
+    @{$new_contents} = splice @{$current->{'contents'}},
+                              $splice_idx, $splice_idx2 - $splice_idx;
+    $table_after_terms = {'type' => $type,
                            'contents' => $new_contents};
-  for my $child (@{$new_contents}) {
-    $child->{'parent'} = $table_after_terms;
+    foreach my $child (@{$new_contents}) {
+      $child->{'parent'} = $table_after_terms;
+    }
   }
 
   if ($type eq 'table_definition') {
     my $before_item;
+
     # setup a table_entry
     my $table_entry = {'type' => 'table_entry',
                     'parent' => $current,
@@ -1845,12 +1851,14 @@ sub _gather_previous_item($$;$$)
     }
     $splice_idx3 = 0 if !defined($splice_idx3);
 
-    $new_contents = [];
-    @{$new_contents} = splice @{$current->{'contents'}},
-                              $splice_idx3, $splice_idx - $splice_idx3;
-    $table_term->{'contents'} = $new_contents;
-    for my $child (@{$new_contents}) {
-      $child->{'parent'} = $table_term;
+    if ($splice_idx3 - $splice_idx) {
+      my $new_contents = [];
+      @{$new_contents} = splice @{$current->{'contents'}},
+                                $splice_idx3, $splice_idx - $splice_idx3;
+      $table_term->{'contents'} = $new_contents;
+      for my $child (@{$new_contents}) {
+        $child->{'parent'} = $table_term;
+      }
     }
     if (defined($before_item) and $before_item->{'contents'}
         and scalar(@{$before_item->{'contents'}})) {
@@ -1870,20 +1878,22 @@ sub _gather_previous_item($$;$$)
         unshift @{$table_term->{'contents'}}, $element;
       }
     }
-    if ($table_after_terms->{'contents'}
-        and scalar(@{$table_after_terms->{'contents'}})) {
+    if ($table_after_terms) {
+      # $table_after_terms necessarily with contents if defined
       push @{$table_entry->{'contents'}}, $table_after_terms;
       $table_after_terms->{'parent'} = $table_entry;
     }
     splice @{$current->{'contents'}}, $splice_idx3, 0, $table_entry;
   } else {
-    my $after_paragraph = _check_no_text($table_after_terms);
-    if ($after_paragraph) {
-      $self->_line_error(__("\@itemx must follow \@item"), $source_info);
-    }
-    if (scalar(@{$table_after_terms->{'contents'}})) {
-      splice @{$current->{'contents'}}, $splice_idx, 0, $table_after_terms;
-      $table_after_terms->{'parent'} = $current;
+    if ($table_after_terms) {
+      my $after_paragraph = _check_no_text($table_after_terms);
+      if ($after_paragraph) {
+        $self->_line_error(__("\@itemx must follow \@item"), $source_info);
+      }
+      if (scalar(@{$table_after_terms->{'contents'}})) {
+        splice @{$current->{'contents'}}, $splice_idx, 0, $table_after_terms;
+        $table_after_terms->{'parent'} = $current;
+      }
     }
   }
 }
@@ -2008,7 +2018,6 @@ sub _close_command_cleanup($$) {
       if ($before_item) {
         if ($before_item->{'contents'}
             and scalar(@{$before_item->{'contents'}}) > 0
-            and @{$before_item->{'contents'}}
             and $before_item->{'contents'}->[-1]->{'cmdname'}
             and $before_item->{'contents'}->[-1]->{'cmdname'} eq 'end') {
           my $end = _pop_element_from_contents($self, $before_item);
@@ -2018,8 +2027,9 @@ sub _close_command_cleanup($$) {
         # remove empty before_items.  Both conditions can happen, the first
         # if the before item remained empty, the second if after removing end
         # and spaces it became empty.
-        if (!$before_item->{'contents'} or
-            scalar(@{$before_item->{'contents'}}) == 0) {
+        if (_is_container_empty($before_item)
+            and not ($before_item->{'source_marks'}
+                     and scalar(@{$before_item->{'source_marks'}}))) {
           if ($leading_spaces) {
             my $space = shift @{$current->{'contents'}};
             shift @{$current->{'contents'}};
@@ -2030,12 +2040,14 @@ sub _close_command_cleanup($$) {
         } else {
           # warn if not empty before_item, but format is empty
           my $empty_before_item = 1;
-          foreach my $before_item_content (@{$before_item->{'contents'}}) {
-            if (!$before_item_content->{'cmdname'} or
-                  ($before_item_content->{'cmdname'} ne 'c'
-                   and $before_item_content->{'cmdname'} ne 'comment')) {
-              $empty_before_item = 0;
-              last;
+          if ($before_item->{'contents'}) {
+            foreach my $before_item_content (@{$before_item->{'contents'}}) {
+              if (!$before_item_content->{'cmdname'} or
+                    ($before_item_content->{'cmdname'} ne 'c'
+                     and $before_item_content->{'cmdname'} ne 'comment')) {
+                $empty_before_item = 0;
+                last;
+              }
             }
           }
           if (!$empty_before_item) {
@@ -2648,10 +2660,6 @@ sub _pop_element_from_contents($$;$)
 
   my $popped_element = pop @{$parent_element->{'contents'}};
   if ($reparent_source_marks and $popped_element->{'source_marks'}) {
-    # FIXME this is wrong, the source mark ends up at a wrong location
-    #_add_source_marks($popped_element->{'source_marks'},
-    #                  $parent_element);
-    # This would be better, but leads to empty elements being kept.
     foreach my $source_mark (@{$popped_element->{'source_marks'}}) {
       _place_source_mark($self, $parent_element, $source_mark);
     }
diff --git a/tp/Texinfo/XS/parsetexi/close.c b/tp/Texinfo/XS/parsetexi/close.c
index 94116b91c2..5cdf7d1cbd 100644
--- a/tp/Texinfo/XS/parsetexi/close.c
+++ b/tp/Texinfo/XS/parsetexi/close.c
@@ -128,7 +128,7 @@ close_container (ELEMENT *current)
           child_element->source_mark_list.number = 0;
 
           debug_nonl ("REMOVE empty child ");
-          debug_print_element_short (child_element, 1); debug("");
+          debug_print_element_short (child_element, 1); debug ("");
           destroy_element (pop_element_from_contents (current, 0));
         }
     }
@@ -136,13 +136,18 @@ close_container (ELEMENT *current)
   if (is_container_empty (current))
     {
       if (current->source_mark_list.number > 0)
-       /* keep the element to keep the source mark, but remove the type. */
-        current->type = ET_NONE;
+        {
+          /* Keep the element to keep the source mark, but remove some types.
+            Keep before_item in order not to add empty table definition in
+            gather_previous_item. */
+          if (current->type != ET_before_item)
+            current->type = ET_NONE;
+        }
       else
         {
           element_to_remove = current;
           debug_nonl ("CONTAINER EMPTY ");
-          debug_print_element_short (current, 1); debug("");
+          debug_print_element_short (current, 1); debug ("");
         }
     }
 
@@ -156,7 +161,7 @@ close_container (ELEMENT *current)
       if (last_child == element_to_remove)
         {
           debug_nonl ("REMOVE empty type ");
-          debug_print_element_short (last_child, 1); debug("");
+          debug_print_element_short (last_child, 1); debug ("");
           destroy_element (pop_element_from_contents (current, 0));
         }
     }
@@ -270,7 +275,8 @@ close_command_cleanup (ELEMENT *current)
             }
 
           /* Now if the ET_before_item is empty, remove it. */
-          if (before_item->contents.number == 0)
+          if (is_container_empty (before_item)
+              && before_item->source_mark_list.number == 0)
             {
               destroy_element (remove_from_contents (current,
                                                 have_leading_spaces ? 1 : 0));
diff --git a/tp/t/22xtable.t b/tp/t/22xtable.t
index e211712097..26330f9197 100644
--- a/tp/t/22xtable.t
+++ b/tp/t/22xtable.t
@@ -59,6 +59,10 @@ VTable
 @item in item before end table
 @end vtable
 '],
+['empty_table',
+'@table @code
+@end table
+'],
 ['long_item',
 '@table @emph
 @item first item      aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 
aaaaaaaaaaaaaaaaaa
diff --git a/tp/t/60macro.t b/tp/t/60macro.t
index cab248a9d3..585a565190 100644
--- a/tp/t/60macro.t
+++ b/tp/t/60macro.t
@@ -385,6 +385,36 @@ a
 
 @pagemacro{} on the line
 '],
+['macro_in_empty_table_empty_before_item',
+'@macro emptymacro
+@end macro
+
+@table @code
+@emptymacro{}@end table
+'],
+['macro_in_table_empty_before_item',
+'@macro emptymacro
+@end macro
+
+@table @code
+@emptymacro{}@item citem
+@end table
+'],
+['macro_in_empty_multitable_empty_before_item',
+'@macro emptymacro
+@end macro
+
+@multitable @columnfractions 0.4 .6 5.
+@emptymacro{}@end multitable
+'],
+['macro_in_multitable_empty_before_item',
+'@macro emptymacro
+@end macro
+
+@multitable @columnfractions 0.4 .6 5.
+@emptymacro{}@item fc @tab sc
+@end multitable
+'],
 ['nested_macro_call',
 '@macro machin{}
 (machin)
diff --git a/tp/t/results/macro/macro_in_empty_multitable_empty_before_item.pl 
b/tp/t/results/macro/macro_in_empty_multitable_empty_before_item.pl
new file mode 100644
index 0000000000..c451e565df
--- /dev/null
+++ b/tp/t/results/macro/macro_in_empty_multitable_empty_before_item.pl
@@ -0,0 +1,214 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'macro_in_empty_multitable_empty_before_item'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'emptymacro',
+              'type' => 'macro_name'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 2,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' emptymacro
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => '0.4 .6 5.'
+                        }
+                      ],
+                      'info' => {
+                        'spaces_after_argument' => {
+                          'text' => '
+'
+                        }
+                      },
+                      'type' => 'line_arg'
+                    }
+                  ],
+                  'cmdname' => 'columnfractions',
+                  'extra' => {
+                    'misc_args' => [
+                      '0.4',
+                      '.6',
+                      '5.'
+                    ]
+                  },
+                  'info' => {
+                    'spaces_before_argument' => {
+                      'text' => ' '
+                    }
+                  },
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 4,
+                    'macro' => ''
+                  }
+                }
+              ],
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'multitable',
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 1,
+                  'element' => {
+                    'args' => [
+                      {
+                        'text' => ''
+                      }
+                    ],
+                    'extra' => {
+                      'name' => 'emptymacro'
+                    },
+                    'type' => 'macro_call'
+                  },
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'start'
+                },
+                {
+                  'counter' => 1,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'type' => 'before_item'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'multitable'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'multitable'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 5,
+                'macro' => ''
+              }
+            }
+          ],
+          'extra' => {
+            'columnfractions' => {},
+            'max_columns' => 3
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 4,
+            'macro' => ''
+          }
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'macro_in_empty_multitable_empty_before_item'}{'contents'}[0]{'contents'}[2]{'extra'}{'columnfractions'}
 = 
$result_trees{'macro_in_empty_multitable_empty_before_item'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0];
+
+$result_texis{'macro_in_empty_multitable_empty_before_item'} = '@macro 
emptymacro
+@end macro
+
+@multitable @columnfractions 0.4 .6 5.
+@end multitable
+';
+
+
+$result_texts{'macro_in_empty_multitable_empty_before_item'} = '
+';
+
+$result_errors{'macro_in_empty_multitable_empty_before_item'} = [];
+
+
+$result_floats{'macro_in_empty_multitable_empty_before_item'} = {};
+
+
+1;
diff --git a/tp/t/results/macro/macro_in_empty_table_empty_before_item.pl 
b/tp/t/results/macro/macro_in_empty_table_empty_before_item.pl
new file mode 100644
index 0000000000..e36397d38a
--- /dev/null
+++ b/tp/t/results/macro/macro_in_empty_table_empty_before_item.pl
@@ -0,0 +1,192 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'macro_in_empty_table_empty_before_item'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'emptymacro',
+              'type' => 'macro_name'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 2,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' emptymacro
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'code',
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 4,
+                    'macro' => ''
+                  },
+                  'type' => 'command_as_argument'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'table',
+          'contents' => [
+            {
+              'source_marks' => [
+                {
+                  'counter' => 1,
+                  'element' => {
+                    'args' => [
+                      {
+                        'text' => ''
+                      }
+                    ],
+                    'extra' => {
+                      'name' => 'emptymacro'
+                    },
+                    'type' => 'macro_call'
+                  },
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'start'
+                },
+                {
+                  'counter' => 1,
+                  'sourcemark_type' => 'macro_expansion',
+                  'status' => 'end'
+                }
+              ],
+              'type' => 'before_item'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'table'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'table'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 5,
+                'macro' => ''
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 4,
+            'macro' => ''
+          }
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'macro_in_empty_table_empty_before_item'}{'contents'}[0]{'contents'}[2]{'extra'}{'command_as_argument'}
 = 
$result_trees{'macro_in_empty_table_empty_before_item'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0];
+
+$result_texis{'macro_in_empty_table_empty_before_item'} = '@macro emptymacro
+@end macro
+
+@table @code
+@end table
+';
+
+
+$result_texts{'macro_in_empty_table_empty_before_item'} = '
+';
+
+$result_errors{'macro_in_empty_table_empty_before_item'} = [];
+
+
+$result_floats{'macro_in_empty_table_empty_before_item'} = {};
+
+
+1;
diff --git a/tp/t/results/macro/macro_in_multitable_empty_before_item.pl 
b/tp/t/results/macro/macro_in_multitable_empty_before_item.pl
new file mode 100644
index 0000000000..968292337b
--- /dev/null
+++ b/tp/t/results/macro/macro_in_multitable_empty_before_item.pl
@@ -0,0 +1,285 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'macro_in_multitable_empty_before_item'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'emptymacro',
+              'type' => 'macro_name'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 2,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' emptymacro
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => '0.4 .6 5.'
+                        }
+                      ],
+                      'info' => {
+                        'spaces_after_argument' => {
+                          'text' => '
+'
+                        }
+                      },
+                      'type' => 'line_arg'
+                    }
+                  ],
+                  'cmdname' => 'columnfractions',
+                  'extra' => {
+                    'misc_args' => [
+                      '0.4',
+                      '.6',
+                      '5.'
+                    ]
+                  },
+                  'info' => {
+                    'spaces_before_argument' => {
+                      'text' => ' '
+                    }
+                  },
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 4,
+                    'macro' => ''
+                  }
+                }
+              ],
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'multitable',
+          'contents' => [
+            {
+              'contents' => [
+                {
+                  'source_marks' => [
+                    {
+                      'counter' => 1,
+                      'element' => {
+                        'args' => [
+                          {
+                            'text' => ''
+                          }
+                        ],
+                        'extra' => {
+                          'name' => 'emptymacro'
+                        },
+                        'type' => 'macro_call'
+                      },
+                      'sourcemark_type' => 'macro_expansion',
+                      'status' => 'start'
+                    },
+                    {
+                      'counter' => 1,
+                      'sourcemark_type' => 'macro_expansion',
+                      'status' => 'end'
+                    }
+                  ],
+                  'text' => ''
+                }
+              ],
+              'type' => 'before_item'
+            },
+            {
+              'contents' => [
+                {
+                  'contents' => [
+                    {
+                      'cmdname' => 'item',
+                      'contents' => [
+                        {
+                          'text' => ' ',
+                          'type' => 'ignorable_spaces_after_command'
+                        },
+                        {
+                          'contents' => [
+                            {
+                              'text' => 'fc '
+                            }
+                          ],
+                          'type' => 'paragraph'
+                        }
+                      ],
+                      'extra' => {
+                        'cell_number' => 1
+                      },
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 5,
+                        'macro' => ''
+                      }
+                    },
+                    {
+                      'cmdname' => 'tab',
+                      'contents' => [
+                        {
+                          'text' => ' ',
+                          'type' => 'ignorable_spaces_after_command'
+                        },
+                        {
+                          'contents' => [
+                            {
+                              'text' => 'sc
+'
+                            }
+                          ],
+                          'type' => 'paragraph'
+                        }
+                      ],
+                      'extra' => {
+                        'cell_number' => 2
+                      },
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 5,
+                        'macro' => ''
+                      }
+                    }
+                  ],
+                  'extra' => {
+                    'row_number' => 1
+                  },
+                  'type' => 'row'
+                }
+              ],
+              'type' => 'multitable_body'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'multitable'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'multitable'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 6,
+                'macro' => ''
+              }
+            }
+          ],
+          'extra' => {
+            'columnfractions' => {},
+            'max_columns' => 3
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 4,
+            'macro' => ''
+          }
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'macro_in_multitable_empty_before_item'}{'contents'}[0]{'contents'}[2]{'extra'}{'columnfractions'}
 = 
$result_trees{'macro_in_multitable_empty_before_item'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0];
+
+$result_texis{'macro_in_multitable_empty_before_item'} = '@macro emptymacro
+@end macro
+
+@multitable @columnfractions 0.4 .6 5.
+@item fc @tab sc
+@end multitable
+';
+
+
+$result_texts{'macro_in_multitable_empty_before_item'} = '
+fc sc
+';
+
+$result_errors{'macro_in_multitable_empty_before_item'} = [];
+
+
+$result_floats{'macro_in_multitable_empty_before_item'} = {};
+
+
+1;
diff --git a/tp/t/results/macro/macro_in_table_empty_before_item.pl 
b/tp/t/results/macro/macro_in_table_empty_before_item.pl
new file mode 100644
index 0000000000..d52f272ccb
--- /dev/null
+++ b/tp/t/results/macro/macro_in_table_empty_before_item.pl
@@ -0,0 +1,238 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'macro_in_table_empty_before_item'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'text' => 'emptymacro',
+              'type' => 'macro_name'
+            }
+          ],
+          'cmdname' => 'macro',
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'macro'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'macro'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 2,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'arg_line' => ' emptymacro
+'
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'code',
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 4,
+                    'macro' => ''
+                  },
+                  'type' => 'command_as_argument'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'table',
+          'contents' => [
+            {
+              'contents' => [
+                {
+                  'source_marks' => [
+                    {
+                      'counter' => 1,
+                      'element' => {
+                        'args' => [
+                          {
+                            'text' => ''
+                          }
+                        ],
+                        'extra' => {
+                          'name' => 'emptymacro'
+                        },
+                        'type' => 'macro_call'
+                      },
+                      'sourcemark_type' => 'macro_expansion',
+                      'status' => 'start'
+                    },
+                    {
+                      'counter' => 1,
+                      'sourcemark_type' => 'macro_expansion',
+                      'status' => 'end'
+                    }
+                  ],
+                  'text' => ''
+                }
+              ],
+              'type' => 'before_item'
+            },
+            {
+              'contents' => [
+                {
+                  'contents' => [
+                    {
+                      'args' => [
+                        {
+                          'contents' => [
+                            {
+                              'text' => 'citem'
+                            }
+                          ],
+                          'info' => {
+                            'spaces_after_argument' => {
+                              'text' => '
+'
+                            }
+                          },
+                          'type' => 'line_arg'
+                        }
+                      ],
+                      'cmdname' => 'item',
+                      'info' => {
+                        'spaces_before_argument' => {
+                          'text' => ' '
+                        }
+                      },
+                      'source_info' => {
+                        'file_name' => '',
+                        'line_nr' => 5,
+                        'macro' => ''
+                      }
+                    }
+                  ],
+                  'type' => 'table_term'
+                }
+              ],
+              'type' => 'table_entry'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'table'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'table'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 6,
+                'macro' => ''
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 4,
+            'macro' => ''
+          }
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'macro_in_table_empty_before_item'}{'contents'}[0]{'contents'}[2]{'extra'}{'command_as_argument'}
 = 
$result_trees{'macro_in_table_empty_before_item'}{'contents'}[0]{'contents'}[2]{'args'}[0]{'contents'}[0];
+
+$result_texis{'macro_in_table_empty_before_item'} = '@macro emptymacro
+@end macro
+
+@table @code
+@item citem
+@end table
+';
+
+
+$result_texts{'macro_in_table_empty_before_item'} = '
+citem
+';
+
+$result_errors{'macro_in_table_empty_before_item'} = [];
+
+
+$result_floats{'macro_in_table_empty_before_item'} = {};
+
+
+1;
diff --git a/tp/t/results/xtable/empty_table.pl 
b/tp/t/results/xtable/empty_table.pl
new file mode 100644
index 0000000000..af242850da
--- /dev/null
+++ b/tp/t/results/xtable/empty_table.pl
@@ -0,0 +1,119 @@
+use vars qw(%result_texis %result_texts %result_trees %result_errors 
+   %result_indices %result_sectioning %result_nodes %result_menus
+   %result_floats %result_converted %result_converted_errors 
+   %result_elements %result_directions_text %result_indices_sort_strings);
+
+use utf8;
+
+$result_trees{'empty_table'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'code',
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 1,
+                    'macro' => ''
+                  },
+                  'type' => 'command_as_argument'
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'table',
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'table'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'table'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 2,
+                'macro' => ''
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 1,
+            'macro' => ''
+          }
+        }
+      ],
+      'type' => 'before_node_section'
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'empty_table'}{'contents'}[0]{'contents'}[0]{'extra'}{'command_as_argument'}
 = 
$result_trees{'empty_table'}{'contents'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+
+$result_texis{'empty_table'} = '@table @code
+@end table
+';
+
+
+$result_texts{'empty_table'} = '';
+
+$result_errors{'empty_table'} = [];
+
+
+$result_floats{'empty_table'} = {};
+
+
+
+$result_converted{'plaintext'}->{'empty_table'} = '';
+
+
+$result_converted{'html_text'}->{'empty_table'} = '';
+
+
+$result_converted{'xml'}->{'empty_table'} = '<table commandarg="code" spaces=" 
" endspaces=" ">
+</table>
+';
+
+
+$result_converted{'docbook'}->{'empty_table'} = 
'<variablelist></variablelist>';
+
+1;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]