texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/Plaintext.pm (process_footno


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/Plaintext.pm (process_footnotes): rename variables and fields.
Date: Sun, 29 Sep 2024 02:42:53 -0400

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 d486b44956 * tp/Texinfo/Convert/Plaintext.pm (process_footnotes): 
rename variables and fields.
d486b44956 is described below

commit d486b449567ef6340384c946ffc2a4abfa7adf20
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Jun 4 23:12:27 2024 +0200

    * tp/Texinfo/Convert/Plaintext.pm (process_footnotes): rename
    variables and fields.
    
    * tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Info.pm
    (format_image), tp/Texinfo/Convert/Plaintext.pm (process_footnotes)
    (format_image, _convert), tp/Texinfo/Convert/Text.pm (_convert),
    tp/Texinfo/XS/convert/convert_html.c (convert_image_command): check
    that extra, info, args and args_formatted exist before accessing
    them.
    
    * tp/Makefile.tres, tp/t/converters_tests.t
    (various_itemize_command_as_argument): add test of various brace
    commands, without braces, as @itemize argument.
---
 ChangeLog                                          |   16 +
 tp/Makefile.tres                                   |    1 +
 tp/Texinfo/Convert/Info.pm                         |    5 +-
 tp/Texinfo/Convert/LaTeX.pm                        |   32 +-
 tp/Texinfo/Convert/Plaintext.pm                    |   25 +-
 tp/Texinfo/Convert/Text.pm                         |    9 +-
 tp/Texinfo/XS/convert/convert_html.c               |    3 +-
 tp/t/converters_tests.t                            |   47 +
 .../various_itemize_command_as_argument.pl         | 1451 ++++++++++++++++++++
 9 files changed, 1562 insertions(+), 27 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e5551f104e..79abf98638 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2024-06-04  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/Plaintext.pm (process_footnotes): rename
+       variables and fields.
+
+       * tp/Texinfo/Convert/LaTeX.pm (_convert), tp/Texinfo/Convert/Info.pm
+       (format_image), tp/Texinfo/Convert/Plaintext.pm (process_footnotes)
+       (format_image, _convert), tp/Texinfo/Convert/Text.pm (_convert),
+       tp/Texinfo/XS/convert/convert_html.c (convert_image_command): check
+       that extra, info, args and args_formatted exist before accessing
+       them.
+
+       * tp/Makefile.tres, tp/t/converters_tests.t
+       (various_itemize_command_as_argument): add test of various brace
+       commands, without braces, as @itemize argument.
+
 2024-06-04  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_end_line_starting_block): check
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 37b7ba3833..42502ba7cb 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -294,6 +294,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/converters_tests/things_before_setfilename_no_element.pl \
   t/results/converters_tests/top_in_ref.pl \
   t/results/converters_tests/unknown_value.pl \
+  t/results/converters_tests/various_itemize_command_as_argument.pl \
   t/results/converters_tests/various_vtable_command_as_argument.pl \
   t/results/coverage/accent_and_dash.pl \
   t/results/coverage/accent_no_closed.pl \
diff --git a/tp/Texinfo/Convert/Info.pm b/tp/Texinfo/Convert/Info.pm
index 47c5f536c8..582239f491 100644
--- a/tp/Texinfo/Convert/Info.pm
+++ b/tp/Texinfo/Convert/Info.pm
@@ -600,9 +600,8 @@ sub format_image($$)
 
   my $lines_count = 0;
 
-  if (defined($element->{'args'}->[0])
-      and $element->{'args'}->[0]->{'contents'}
-      and @{$element->{'args'}->[0]->{'contents'}}) {
+  if ($element->{'args'}
+      and $element->{'args'}->[0]->{'contents'}) {
     Texinfo::Convert::Text::set_options_code(
                                  $self->{'convert_text_options'});
     my $basefile = Texinfo::Convert::Text::convert_to_text(
diff --git a/tp/Texinfo/Convert/LaTeX.pm b/tp/Texinfo/Convert/LaTeX.pm
index 5ae001b7ef..c93023aa0a 100644
--- a/tp/Texinfo/Convert/LaTeX.pm
+++ b/tp/Texinfo/Convert/LaTeX.pm
@@ -2652,11 +2652,13 @@ sub _convert($$)
                      and $Texinfo::Commands::brace_commands{$cmdname} eq 
'inline'
                      and $cmdname ne 'inlinefmtifelse'
                      and (($inline_format_commands{$cmdname}
-                          and (!$element->{'extra'}->{'format'}
+                          and (!$element->{'extra'}
+                               or !$element->{'extra'}->{'format'}
                                or !$self->{'expanded_formats'}
                                       ->{$element->{'extra'}->{'format'}}))
                          or (!$inline_format_commands{$cmdname}
-                             and 
!defined($element->{'extra'}->{'expand_index'}))))))) {
+                             and (!$element->{'extra'}
+                     or !defined($element->{'extra'}->{'expand_index'})))))))) 
{
     return $result;
   }
 
@@ -2961,7 +2963,14 @@ sub _convert($$)
       # whether we are in another LaTeX macro would probably be a pain.
       # It should be ok, though, as it is described as an error in the manual:
       #   It is not reliable to use @verb inside other Texinfo constructs
-      my $delim = $element->{'info'}->{'delimiter'};
+      my $delim;
+      if ($element->{'info'}
+          and defined($element->{'info'}->{'delimiter'})) {
+        $delim = $element->{'info'}->{'delimiter'};
+      } else {
+        # delimiter also tried below
+        $delim = '|';
+      }
       my $contents = '';
       my @lines;
 
@@ -2993,9 +3002,8 @@ sub _convert($$)
       $result .= join "\\\\\n", @lines_out;
       return $result;
     } elsif ($cmdname eq 'image') {
-      if (defined($element->{'args'}->[0])
-          and $element->{'args'}->[0]->{'contents'}
-          and @{$element->{'args'}->[0]->{'contents'}}) {
+      if ($element->{'args'}
+          and $element->{'args'}->[0]->{'contents'}) {
         # distinguish text basefile used to find the file and
         # converted basefile with special characters escaped
         Texinfo::Convert::Text::set_options_code(
@@ -3170,14 +3178,18 @@ sub _convert($$)
     } elsif ($cmdname eq 'footnote') {
       _push_new_context($self, 'footnote');
       $result .= '\footnote{';
-      $result .= $self->_convert($element->{'args'}->[0]);
+      if ($element->{'args'}) {
+        $result .= $self->_convert($element->{'args'}->[0]);
+      }
       $result .= '}';
       _pop_context($self);
       return $result;
     } elsif ($cmdname eq 'anchor') {
-      my $anchor_label
-         = _tree_anchor_label($element->{'args'}->[0]->{'contents'});
-      $result .= "\\label{$anchor_label}%\n";
+      if ($element->{'args'}) {
+        my $anchor_label
+           = _tree_anchor_label($element->{'args'}->[0]->{'contents'});
+        $result .= "\\label{$anchor_label}%\n";
+      }
       return $result;
     } elsif ($ref_commands{$cmdname}) {
       if (scalar(@{$element->{'args'}})) {
diff --git a/tp/Texinfo/Convert/Plaintext.pm b/tp/Texinfo/Convert/Plaintext.pm
index 5c4b385044..0c818f5dfc 100644
--- a/tp/Texinfo/Convert/Plaintext.pm
+++ b/tp/Texinfo/Convert/Plaintext.pm
@@ -1317,7 +1317,8 @@ sub process_footnotes($;$)
       $self->{'current_node'} = $footnotes_node;
     }
     while (@{$self->{'pending_footnotes'}}) {
-      my $footnote = shift (@{$self->{'pending_footnotes'}});
+      my $footnote_info = shift (@{$self->{'pending_footnotes'}});
+      my $footnote_number = $footnote_info->{'number'};
 
       # If nested within another footnote and footnotestyle is separate,
       # the element here will be the parent element and not the footnote
@@ -1325,7 +1326,7 @@ sub process_footnotes($;$)
       # footnote node taken into account.  Not really problematic as
       # nested footnotes are not right.
       if ($label_element) {
-        my $footnote_anchor_postfix = "-Footnote-$footnote->{'number'}";
+        my $footnote_anchor_postfix = "-Footnote-$footnote_number";
         my $footnote_anchor_arg
          = {'contents' => [$label_element,
                            {'text' => $footnote_anchor_postfix}]};
@@ -1341,7 +1342,7 @@ sub process_footnotes($;$)
       $self->push_top_formatter('footnote');
       my $formatted_footnote_number;
       if ($self->get_conf('NUMBER_FOOTNOTES')) {
-        $formatted_footnote_number = $footnote->{'number'};
+        $formatted_footnote_number = $footnote_number;
       } else {
         $formatted_footnote_number = $NO_NUMBER_FOOTNOTE_SYMBOL;
       }
@@ -1351,7 +1352,10 @@ sub process_footnotes($;$)
          Texinfo::Convert::Unicode::string_width($footnote_text);
       _stream_output($self, $footnote_text);
 
-      $self->_convert($footnote->{'root'}->{'args'}->[0]);
+      my $footnote_element = $footnote_info->{'footnote_element'};
+      if ($footnote_element->{'args'}) {
+        $self->_convert($footnote_element->{'args'}->[0]);
+      }
       _add_newline_if_needed($self);
 
       my $old_context = $self->pop_top_formatter();
@@ -1947,9 +1951,8 @@ sub format_image($$)
 {
   my ($self, $element) = @_;
 
-  if (defined($element->{'args'}->[0])
-      and $element->{'args'}->[0]->{'contents'}
-      and @{$element->{'args'}->[0]->{'contents'}}) {
+  if ($element->{'args'}
+      and $element->{'args'}->[0]->{'contents'}) {
     Texinfo::Convert::Text::set_options_code(
                                  $self->{'convert_text_options'});
     my $basefile = Texinfo::Convert::Text::convert_to_text(
@@ -2078,11 +2081,13 @@ sub _convert($$)
                      and $brace_commands{$command} eq 'inline'
                      and $command ne 'inlinefmtifelse'
                      and (($inline_format_commands{$command}
-                          and (!$element->{'extra'}->{'format'}
+                          and (!$element->{'extra'}
+                               or !$element->{'extra'}->{'format'}
                                or !$self->{'expanded_formats'}
                                            
->{$element->{'extra'}->{'format'}}))
                          or (!$inline_format_commands{$command}
-                             and 
!defined($element->{'extra'}->{'expand_index'}))))))) {
+                             and (!$element->{'extra'}
+                  or  !defined($element->{'extra'}->{'expand_index'})))))))) {
     return;
   }
 
@@ -2855,7 +2860,7 @@ sub _convert($$)
         } else {
           $formatted_footnote_number = $NO_NUMBER_FOOTNOTE_SYMBOL;
         }
-        push @{$self->{'pending_footnotes'}}, {'root' => $element,
+        push @{$self->{'pending_footnotes'}}, {'footnote_element' => $element,
                                       'number' => $self->{'footnote_index'}}
             unless ($self->{'multiple_pass'});
         if (!$self->{'in_copying_header'}) {
diff --git a/tp/Texinfo/Convert/Text.pm b/tp/Texinfo/Convert/Text.pm
index 1a232dbaa7..63f556d020 100644
--- a/tp/Texinfo/Convert/Text.pm
+++ b/tp/Texinfo/Convert/Text.pm
@@ -458,13 +458,15 @@ sub _convert($$)
                      and $element->{'cmdname'} ne 'inlinefmtifelse'
                      and (($Texinfo::Commands::inline_format_commands{
                                                          $element->{'cmdname'}}
-                           and (!$element->{'extra'}->{'format'}
+                           and (!$element->{'extra'}
+                                or !$element->{'extra'}->{'format'}
                                 or !$options->{'expanded_formats'}
                                 or !$options->{'expanded_formats'}
                                            
->{$element->{'extra'}->{'format'}}))
                          or (!$Texinfo::Commands::inline_format_commands{
                                                           
$element->{'cmdname'}}
-                             and 
!defined($element->{'extra'}->{'expand_index'}))))
+                             and (!$element->{'extra'}
+                                  or 
!defined($element->{'extra'}->{'expand_index'})))))
              # here ignore most of the line commands
                  or ($element->{'args'} and $element->{'args'}->[0]
                      and $element->{'args'}->[0]->{'type'}
@@ -569,7 +571,8 @@ sub _convert($$)
       }
       my $arg_index = 1;
       if ($element->{'cmdname'} eq 'inlinefmtifelse'
-          and (!$element->{'extra'}->{'format'}
+          and (!$element->{'extra'}
+               or !$element->{'extra'}->{'format'}
                or !$options->{'expanded_formats'}
                or !$options->{'expanded_formats'}
                                    ->{$element->{'extra'}->{'format'}})) {
diff --git a/tp/Texinfo/XS/convert/convert_html.c 
b/tp/Texinfo/XS/convert/convert_html.c
index 7d170cd0b1..8bddcf8324 100644
--- a/tp/Texinfo/XS/convert/convert_html.c
+++ b/tp/Texinfo/XS/convert/convert_html.c
@@ -9541,7 +9541,8 @@ convert_image_command (CONVERTER *self, const enum 
command_id cmd,
                     const HTML_ARGS_FORMATTED *args_formatted,
                     const char *content, TEXT *result)
 {
-  if (args_formatted->number > 0
+  if (args_formatted
+      && args_formatted->number > 0
       && args_formatted->args[0].formatted[AFT_type_filenametext]
       && strlen (args_formatted->args[0].formatted[AFT_type_filenametext]))
     {
diff --git a/tp/t/converters_tests.t b/tp/t/converters_tests.t
index 4c4b039565..ed774ef0d3 100644
--- a/tp/t/converters_tests.t
+++ b/tp/t/converters_tests.t
@@ -914,6 +914,53 @@ discussion
 
 @printindex vr
 ',],
+['various_itemize_command_as_argument',
+'@node Top
+@top top
+
+@node chap
+@chapter Chap
+
+@itemize @inlineraw
+@item Inlineraw
+@end itemize
+
+@itemize @image
+@item Image
+@item Second
+@end itemize
+
+@itemize @footnote
+@item aa
+@item F2
+aa
+
+T
+
+@end itemize
+
+@itemize @caption
+@item Caption
+@end itemize
+
+@itemize @math
+@item a + b
+@item a@sup{c}
+
+2
+
+@end itemize
+
+@itemize @anchor
+@item anchor 1
+@item anchor 2
+@end itemize
+
+@itemize @verb
+@item :uu:
+@end itemize
+
+'],
 ['at_commands_in_raw',
 '@node Top
 @top top
diff --git 
a/tp/t/results/converters_tests/various_itemize_command_as_argument.pl 
b/tp/t/results/converters_tests/various_itemize_command_as_argument.pl
new file mode 100644
index 0000000000..d3eb48d8f7
--- /dev/null
+++ b/tp/t/results/converters_tests/various_itemize_command_as_argument.pl
@@ -0,0 +1,1451 @@
+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{'various_itemize_command_as_argument'} = {
+  'contents' => [
+    {
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'is_target' => 1,
+        'normalized' => 'Top'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 1
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'top',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 2
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'chap'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'is_target' => 1,
+        'normalized' => 'chap'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 4
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Chap'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'inlineraw',
+                  'source_info' => {
+                    'line_nr' => 7
+                  }
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'itemize',
+          'contents' => [
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'Inlineraw
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 1
+              },
+              'source_info' => {
+                'line_nr' => 8
+              }
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'itemize'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'itemize'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'line_nr' => 9
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'line_nr' => 7
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'image',
+                  'source_info' => {
+                    'line_nr' => 11
+                  }
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'itemize',
+          'contents' => [
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'Image
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 1
+              },
+              'source_info' => {
+                'line_nr' => 12
+              }
+            },
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'Second
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 2
+              },
+              'source_info' => {
+                'line_nr' => 13
+              }
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'itemize'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'itemize'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'line_nr' => 14
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'line_nr' => 11
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'footnote',
+                  'source_info' => {
+                    'line_nr' => 16
+                  }
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'itemize',
+          'contents' => [
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'aa
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 1
+              },
+              'source_info' => {
+                'line_nr' => 17
+              }
+            },
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'F2
+'
+                    },
+                    {
+                      'text' => 'aa
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                },
+                {
+                  'text' => '
+',
+                  'type' => 'empty_line'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'T
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                },
+                {
+                  'text' => '
+',
+                  'type' => 'empty_line'
+                }
+              ],
+              'extra' => {
+                'item_number' => 2
+              },
+              'source_info' => {
+                'line_nr' => 18
+              }
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'itemize'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'itemize'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'line_nr' => 23
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'line_nr' => 16
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'caption',
+                  'source_info' => {
+                    'line_nr' => 25
+                  }
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'itemize',
+          'contents' => [
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'Caption
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 1
+              },
+              'source_info' => {
+                'line_nr' => 26
+              }
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'itemize'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'itemize'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'line_nr' => 27
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'line_nr' => 25
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'math',
+                  'source_info' => {
+                    'line_nr' => 29
+                  }
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'itemize',
+          'contents' => [
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'a + b
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 1
+              },
+              'source_info' => {
+                'line_nr' => 30
+              }
+            },
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'a'
+                    },
+                    {
+                      'args' => [
+                        {
+                          'contents' => [
+                            {
+                              'text' => 'c'
+                            }
+                          ],
+                          'type' => 'brace_container'
+                        }
+                      ],
+                      'cmdname' => 'sup',
+                      'source_info' => {
+                        'line_nr' => 31
+                      }
+                    },
+                    {
+                      'text' => '
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                },
+                {
+                  'text' => '
+',
+                  'type' => 'empty_line'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => '2
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                },
+                {
+                  'text' => '
+',
+                  'type' => 'empty_line'
+                }
+              ],
+              'extra' => {
+                'item_number' => 2
+              },
+              'source_info' => {
+                'line_nr' => 31
+              }
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'itemize'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'itemize'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'line_nr' => 35
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'line_nr' => 29
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'anchor',
+                  'source_info' => {
+                    'line_nr' => 37
+                  }
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'itemize',
+          'contents' => [
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'anchor 1
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 1
+              },
+              'source_info' => {
+                'line_nr' => 38
+              }
+            },
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => 'anchor 2
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 2
+              },
+              'source_info' => {
+                'line_nr' => 39
+              }
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'itemize'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'itemize'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'line_nr' => 40
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'line_nr' => 37
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'contents' => [
+                {
+                  'cmdname' => 'verb',
+                  'source_info' => {
+                    'line_nr' => 42
+                  }
+                }
+              ],
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'itemize',
+          'contents' => [
+            {
+              'cmdname' => 'item',
+              'contents' => [
+                {
+                  'text' => ' ',
+                  'type' => 'ignorable_spaces_after_command'
+                },
+                {
+                  'contents' => [
+                    {
+                      'text' => ':uu:
+'
+                    }
+                  ],
+                  'type' => 'paragraph'
+                }
+              ],
+              'extra' => {
+                'item_number' => 1
+              },
+              'source_info' => {
+                'line_nr' => 43
+              }
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'itemize'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'itemize'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'line_nr' => 44
+              }
+            }
+          ],
+          'extra' => {
+            'command_as_argument' => {}
+          },
+          'info' => {
+            'spaces_before_argument' => {
+              'text' => ' '
+            }
+          },
+          'source_info' => {
+            'line_nr' => 42
+          }
+        },
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {
+        'section_number' => '1'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'line_nr' => 5
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[1]{'extra'}{'command_as_argument'}
 = 
$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[3]{'extra'}{'command_as_argument'}
 = 
$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[3]{'args'}[0]{'contents'}[0];
+$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[5]{'extra'}{'command_as_argument'}
 = 
$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[5]{'args'}[0]{'contents'}[0];
+$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[7]{'extra'}{'command_as_argument'}
 = 
$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[7]{'args'}[0]{'contents'}[0];
+$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[9]{'extra'}{'command_as_argument'}
 = 
$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[9]{'args'}[0]{'contents'}[0];
+$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[11]{'extra'}{'command_as_argument'}
 = 
$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[11]{'args'}[0]{'contents'}[0];
+$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[13]{'extra'}{'command_as_argument'}
 = 
$result_trees{'various_itemize_command_as_argument'}{'contents'}[4]{'contents'}[13]{'args'}[0]{'contents'}[0];
+
+$result_texis{'various_itemize_command_as_argument'} = '@node Top
+@top top
+
+@node chap
+@chapter Chap
+
+@itemize @inlineraw
+@item Inlineraw
+@end itemize
+
+@itemize @image
+@item Image
+@item Second
+@end itemize
+
+@itemize @footnote
+@item aa
+@item F2
+aa
+
+T
+
+@end itemize
+
+@itemize @caption
+@item Caption
+@end itemize
+
+@itemize @math
+@item a + b
+@item a@sup{c}
+
+2
+
+@end itemize
+
+@itemize @anchor
+@item anchor 1
+@item anchor 2
+@end itemize
+
+@itemize @verb
+@item :uu:
+@end itemize
+
+';
+
+
+$result_texts{'various_itemize_command_as_argument'} = 'top
+***
+
+1 Chap
+******
+
+Inlineraw
+
+Image
+Second
+
+aa
+F2
+aa
+
+T
+
+
+Caption
+
+a + b
+ac
+
+2
+
+
+anchor 1
+anchor 2
+
+:uu:
+
+';
+
+$result_sectioning{'various_itemize_command_as_argument'} = {
+  'extra' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'top',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'Top'
+            }
+          },
+          'section_childs' => [
+            {
+              'cmdname' => 'chapter',
+              'extra' => {
+                'associated_node' => {
+                  'cmdname' => 'node',
+                  'extra' => {
+                    'normalized' => 'chap'
+                  }
+                },
+                'section_directions' => {
+                  'up' => {}
+                },
+                'section_level' => 1,
+                'section_number' => '1',
+                'toplevel_directions' => {
+                  'prev' => {},
+                  'up' => {}
+                }
+              }
+            }
+          ],
+          'section_level' => 0,
+          'sectioning_root' => {},
+          'toplevel_directions' => {}
+        }
+      }
+    ],
+    'section_level' => -1
+  }
+};
+$result_sectioning{'various_itemize_command_as_argument'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'section_directions'}{'up'}
 = 
$result_sectioning{'various_itemize_command_as_argument'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'various_itemize_command_as_argument'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'toplevel_directions'}{'prev'}
 = 
$result_sectioning{'various_itemize_command_as_argument'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'various_itemize_command_as_argument'}{'extra'}{'section_childs'}[0]{'extra'}{'section_childs'}[0]{'extra'}{'toplevel_directions'}{'up'}
 = 
$result_sectioning{'various_itemize_command_as_argument'}{'extra'}{'section_childs'}[0];
+$result_sectioning{'various_itemize_command_as_argument'}{'extra'}{'section_childs'}[0]{'extra'}{'sectioning_root'}
 = $result_sectioning{'various_itemize_command_as_argument'};
+
+$result_nodes{'various_itemize_command_as_argument'} = [
+  {
+    'cmdname' => 'node',
+    'extra' => {
+      'associated_section' => {
+        'cmdname' => 'top',
+        'extra' => {}
+      },
+      'node_directions' => {
+        'next' => {
+          'cmdname' => 'node',
+          'extra' => {
+            'associated_section' => {
+              'cmdname' => 'chapter',
+              'extra' => {
+                'section_number' => '1'
+              }
+            },
+            'node_directions' => {
+              'prev' => {},
+              'up' => {}
+            },
+            'normalized' => 'chap'
+          }
+        }
+      },
+      'normalized' => 'Top'
+    }
+  },
+  {}
+];
+$result_nodes{'various_itemize_command_as_argument'}[0]{'extra'}{'node_directions'}{'next'}{'extra'}{'node_directions'}{'prev'}
 = $result_nodes{'various_itemize_command_as_argument'}[0];
+$result_nodes{'various_itemize_command_as_argument'}[0]{'extra'}{'node_directions'}{'next'}{'extra'}{'node_directions'}{'up'}
 = $result_nodes{'various_itemize_command_as_argument'}[0];
+$result_nodes{'various_itemize_command_as_argument'}[1] = 
$result_nodes{'various_itemize_command_as_argument'}[0]{'extra'}{'node_directions'}{'next'};
+
+$result_menus{'various_itemize_command_as_argument'} = [
+  {
+    'extra' => {
+      'normalized' => 'Top'
+    }
+  },
+  {
+    'extra' => {
+      'normalized' => 'chap'
+    }
+  }
+];
+
+$result_errors{'various_itemize_command_as_argument'} = [
+  {
+    'error_line' => 'warning: @inlineraw expected braces
+',
+    'line_nr' => 7,
+    'text' => '@inlineraw expected braces',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @image expected braces
+',
+    'line_nr' => 11,
+    'text' => '@image expected braces',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @footnote should not appear on @itemize line
+',
+    'line_nr' => 16,
+    'text' => '@footnote should not appear on @itemize line',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @footnote expected braces
+',
+    'line_nr' => 16,
+    'text' => '@footnote expected braces',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @caption should not appear on @itemize line
+',
+    'line_nr' => 25,
+    'text' => '@caption should not appear on @itemize line',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @caption expected braces
+',
+    'line_nr' => 25,
+    'text' => '@caption expected braces',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @math expected braces
+',
+    'line_nr' => 29,
+    'text' => '@math expected braces',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @anchor should not appear on @itemize line
+',
+    'line_nr' => 37,
+    'text' => '@anchor should not appear on @itemize line',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @anchor expected braces
+',
+    'line_nr' => 37,
+    'text' => '@anchor expected braces',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @verb should not appear on @itemize line
+',
+    'line_nr' => 42,
+    'text' => '@verb should not appear on @itemize line',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @verb expected braces
+',
+    'line_nr' => 42,
+    'text' => '@verb expected braces',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'various_itemize_command_as_argument'} = {};
+
+
+
+$result_converted{'plaintext'}->{'various_itemize_command_as_argument'} = 'top
+***
+
+1 Chap
+******
+
+     Inlineraw
+
+     Image
+     Second
+
+   (1) aa
+   (2) F2 aa
+
+     T
+
+     Caption
+
+     a + b
+     a^{c}
+
+     2
+
+     anchor 1
+     anchor 2
+
+     :uu:
+
+   ---------- Footnotes ----------
+
+   (1) 
+   (2) 
+';
+
+
+$result_converted{'html_text'}->{'various_itemize_command_as_argument'} = 
'<div class="top-level-extent" id="Top">
+<h1 class="top" id="top"><span>top<a class="copiable-link" href="#top"> 
&para;</a></span></h1>
+
+<ul class="mini-toc">
+<li><a href="#chap" accesskey="1">Chap</a></li>
+</ul>
+<hr>
+<div class="chapter-level-extent" id="chap">
+<h2 class="chapter" id="Chap"><span>1 Chap<a class="copiable-link" 
href="#Chap"> &para;</a></span></h2>
+
+<ul class="itemize">
+<li>Inlineraw
+</li></ul>
+
+<ul class="itemize">
+<li>Image
+</li><li>Second
+</li></ul>
+
+<ul class="itemize" style="list-style-type: \'(1)\'">
+<li>aa
+</li><li>F2
+aa
+
+<p>T
+</p>
+</li></ul>
+
+<ul class="itemize">
+<li>Caption
+</li></ul>
+
+<ul class="itemize">
+<li>a + b
+</li><li>a<sup class="sup">c</sup>
+
+<p>2
+</p>
+</li></ul>
+
+<ul class="itemize">
+<li>anchor 1
+</li><li>anchor 2
+</li></ul>
+
+<ul class="itemize">
+<li>:uu:
+</li></ul>
+
+</div>
+</div>
+';
+
+
+$result_converted{'xml'}->{'various_itemize_command_as_argument'} = '<node 
name="Top" spaces=" "><nodename>Top</nodename><nodenext 
automatic="on">chap</nodenext></node>
+<top spaces=" "><sectiontitle>top</sectiontitle>
+
+</top>
+<node name="chap" spaces=" "><nodename>chap</nodename><nodeprev 
automatic="on">Top</nodeprev><nodeup automatic="on">Top</nodeup></node>
+<chapter spaces=" "><sectiontitle>Chap</sectiontitle>
+
+<itemize commandarg="inlineraw" spaces=" " endspaces=" ">
+<listitem><prepend></prepend> <para>Inlineraw
+</para></listitem></itemize>
+
+<itemize commandarg="image" spaces=" " endspaces=" ">
+<listitem><prepend></prepend> <para>Image
+</para></listitem><listitem><prepend></prepend> <para>Second
+</para></listitem></itemize>
+
+<itemize commandarg="footnote" spaces=" " endspaces=" ">
+<listitem><prepend></prepend> <para>aa
+</para></listitem><listitem><prepend></prepend> <para>F2
+aa
+</para>
+<para>T
+</para>
+</listitem></itemize>
+
+<itemize commandarg="caption" spaces=" " endspaces=" ">
+<listitem><prepend></prepend> <para>Caption
+</para></listitem></itemize>
+
+<itemize commandarg="math" spaces=" " endspaces=" ">
+<listitem><prepend></prepend> <para>a + b
+</para></listitem><listitem><prepend></prepend> <para>a<sup>c</sup>
+</para>
+<para>2
+</para>
+</listitem></itemize>
+
+<itemize commandarg="anchor" spaces=" " endspaces=" ">
+<listitem><prepend></prepend> <para>anchor 1
+</para></listitem><listitem><prepend></prepend> <para>anchor 2
+</para></listitem></itemize>
+
+<itemize commandarg="verb" spaces=" " endspaces=" ">
+<listitem><prepend></prepend> <para>:uu:
+</para></listitem></itemize>
+
+</chapter>
+';
+
+
+$result_converted{'docbook'}->{'various_itemize_command_as_argument'} = 
'<chapter label="1" id="chap">
+<title>Chap</title>
+
+<itemizedlist><listitem><para> Inlineraw
+</para></listitem></itemizedlist>
+<itemizedlist><listitem><para> Image
+</para></listitem><listitem><para> Second
+</para></listitem></itemizedlist>
+<itemizedlist><listitem><para> aa
+</para></listitem><listitem><para> F2
+aa
+</para>
+<para>T
+</para>
+</listitem></itemizedlist>
+<itemizedlist><listitem><para> Caption
+</para></listitem></itemizedlist>
+<itemizedlist><listitem><para> a + b
+</para></listitem><listitem><para> a<superscript>c</superscript>
+</para>
+<para>2
+</para>
+</listitem></itemizedlist>
+<itemizedlist><listitem><para> anchor 1
+</para></listitem><listitem><para> anchor 2
+</para></listitem></itemizedlist>
+<itemizedlist><listitem><para> :uu:
+</para></listitem></itemizedlist>
+</chapter>
+';
+
+
+$result_converted{'latex_text'}->{'various_itemize_command_as_argument'} = 
'\\label{anchor:Top}%
+\\chapter{{Chap}}
+\\label{anchor:chap}%
+
+\\begin{itemize}
+\\item Inlineraw
+\\end{itemize}
+
+\\begin{itemize}
+\\item Image
+\\item Second
+\\end{itemize}
+
+\\begin{itemize}[label=\\footnote{}]
+\\item aa
+\\item F2
+aa
+
+T
+
+\\end{itemize}
+
+\\begin{itemize}
+\\item Caption
+\\end{itemize}
+
+\\begin{itemize}
+\\item a + b
+\\item a\\textsuperscript{c}
+
+2
+
+\\end{itemize}
+
+\\begin{itemize}
+\\item anchor 1
+\\item anchor 2
+\\end{itemize}
+
+\\begin{itemize}
+\\item :uu:
+\\end{itemize}
+
+';
+
+1;



reply via email to

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