texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/Convert/HTML.pm (command_text, _conv


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/Convert/HTML.pm (command_text, _convert_xref_commands) (_initialize_output_state): add 'referred_command_stack' to put commands that can be referred to being expanded, to catch if an @*ref refers to that command during the expansion, leading to an infinite recursion. In that case, use the node instead of the section, as with nodes only it is not possible to construct a an infinite recursion as the node must both be a reference target and refer to a specific target at the same [...]
Date: Tue, 22 Nov 2022 14:37:44 -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 89594d63e7 * tp/Texinfo/Convert/HTML.pm (command_text, 
_convert_xref_commands) (_initialize_output_state): add 
'referred_command_stack' to put commands that can be referred to being 
expanded, to catch if an @*ref refers to that command during the expansion, 
leading to an infinite recursion.  In that case, use the node instead of the 
section, as with nodes only it is not possible to construct a an infinite 
recursion as the node must both be a reference target and refer to a specif 
[...]
89594d63e7 is described below

commit 89594d63e7f5fa0796be4c0002d6200219ef5e62
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Tue Nov 22 20:37:32 2022 +0100

    * tp/Texinfo/Convert/HTML.pm (command_text, _convert_xref_commands)
    (_initialize_output_state): add 'referred_command_stack' to put
    commands that can be referred to being expanded, to catch if an @*ref
    refers to that command during the expansion, leading to an infinite
    recursion.  In that case, use the node instead of the section, as with
    nodes only it is not possible to construct a an infinite recursion
    as the node must both be a reference target and refer to a specific
    target at the same time, which is not possible.  Report from David
    Bacon.
---
 ChangeLog                                          |  12 +
 tp/Texinfo/Convert/HTML.pm                         |  17 +-
 tp/t/30sectioning.t                                |  20 +
 ...double_recursive_self_section_node_reference.pl | 488 +++++++++++++++++++++
 .../double_recursive_self_section_reference.pl     | 397 +++++++++++++++++
 .../sectioning/recursive_self_section_reference.pl | 231 ++++++++++
 6 files changed, 1164 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ce8abee3e4..e5d0f5ddb3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2022-11-22  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/Convert/HTML.pm (command_text, _convert_xref_commands)
+       (_initialize_output_state): add 'referred_command_stack' to put
+       commands that can be referred to being expanded, to catch if an @*ref
+       refers to that command during the expansion, leading to an infinite
+       recursion.  In that case, use the node instead of the section, as with
+       nodes only it is not possible to construct a an infinite recursion
+       as the node must both be a reference target and refer to a specific
+       target at the same time, which is not possible.  Report from David
+       Bacon.
+
 2022-11-21  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/Convert/HTML.pm (_convert_printindex_command): do not add
diff --git a/tp/Texinfo/Convert/HTML.pm b/tp/Texinfo/Convert/HTML.pm
index c3091c5496..e4310d1cf5 100644
--- a/tp/Texinfo/Convert/HTML.pm
+++ b/tp/Texinfo/Convert/HTML.pm
@@ -1131,7 +1131,9 @@ sub command_text($$;$)
         if (defined($target->{'tree_nonumber'}));
     }
     $self->{'ignore_notice'}++;
+    push @{$self->{'referred_command_stack'}}, $command;
     $target->{$type} = $self->_convert($tree, $explanation);
+    pop @{$self->{'referred_command_stack'}};
     $self->{'ignore_notice'}--;
 
     $self->_pop_document_context();
@@ -5141,7 +5143,15 @@ sub _convert_xref_commands($$$$)
 
     if (!defined($name)) {
       if ($self->get_conf('xrefautomaticsectiontitle') eq 'on'
-         and $node->{'extra'}->{'associated_section'}) {
+         and $node->{'extra'}->{'associated_section'}
+         # this condition avoids infinite recursions, indeed in that case
+         # the node will be used and not the section.  There should not be
+         # @*ref in nodes, and even if there are, it does not seems to be
+         # possible to construct an infinite recursion with nodes only
+         # as the node must both be a reference target and refer to a specific
+         # target at the same time, which is not possible.
+         and not grep {$_ eq $node->{'extra'}->{'associated_section'}}
+                     @{$self->{'referred_command_stack'}}) {
         $command = $node->{'extra'}->{'associated_section'};
         $name = $self->command_text($command, 'text_nonumber');
       } elsif ($node->{'cmdname'} eq 'float') {
@@ -7441,6 +7451,7 @@ sub _load_htmlxref_files {
 #  options_latex_math
 #  htmlxref
 #  check_htmlxref_already_warned
+#  referred_command_stack
 #
 #    from Converter
 #  labels
@@ -10153,6 +10164,10 @@ sub _initialize_output_state($)
   $self->{'targets'} = {};
   $self->{'seen_ids'} = {};
 
+  # to avoid infinite recursions when a section refers to itself, possibly
+  # indirectly
+  $self->{'referred_command_stack'} = [];
+
   # for directions to special elements, only filled if special
   # elements are actually used.
   $self->{'special_elements_directions'} = {};
diff --git a/tp/t/30sectioning.t b/tp/t/30sectioning.t
index a957e259da..2e12768b89 100644
--- a/tp/t/30sectioning.t
+++ b/tp/t/30sectioning.t
@@ -536,6 +536,26 @@ in node Top
 
 in chap
 '],
+['recursive_self_section_reference',
+'@node sharp
+@chapter @ref{sharp} tuple
+'],
+['double_recursive_self_section_reference',
+'@node n1
+@chapter @ref{n2}
+
+@node n2
+@chapter @ref{n1}
+'],
+['double_recursive_self_section_node_reference',
+'@node Top
+@top top
+
+@node node1
+@chapter @ref{to node1}
+
+@node to @ref{node1}
+'],
 );
 
 my $character_and_spaces_in_refs_text = '@node Top
diff --git 
a/tp/t/results/sectioning/double_recursive_self_section_node_reference.pl 
b/tp/t/results/sectioning/double_recursive_self_section_node_reference.pl
new file mode 100644
index 0000000000..6e1e49817c
--- /dev/null
+++ b/tp/t/results/sectioning/double_recursive_self_section_node_reference.pl
@@ -0,0 +1,488 @@
+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{'double_recursive_self_section_node_reference'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [],
+          'type' => 'preamble_before_content'
+        }
+      ],
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'Top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'node_content' => [
+          {}
+        ],
+        'nodes_manuals' => [
+          {
+            'node_content' => [
+              {}
+            ],
+            'normalized' => 'Top'
+          }
+        ],
+        'normalized' => 'Top'
+      },
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'top'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'top',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 2,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'node1'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'node_content' => [
+          {}
+        ],
+        'nodes_manuals' => [
+          {
+            'node_content' => [
+              {}
+            ],
+            'normalized' => 'node1'
+          }
+        ],
+        'normalized' => 'node1'
+      },
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 4,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'to node1'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'ref',
+              'extra' => {
+                'label' => {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => 'to '
+                        },
+                        {
+                          'args' => [
+                            {
+                              'contents' => [
+                                {
+                                  'text' => 'node1'
+                                }
+                              ],
+                              'type' => 'brace_command_arg'
+                            }
+                          ],
+                          'cmdname' => 'ref',
+                          'extra' => {
+                            'label' => {},
+                            'node_argument' => {
+                              'node_content' => [
+                                {}
+                              ],
+                              'normalized' => 'node1'
+                            }
+                          },
+                          'source_info' => {
+                            'file_name' => '',
+                            'line_nr' => 7,
+                            'macro' => ''
+                          }
+                        }
+                      ],
+                      'info' => {
+                        'spaces_after_argument' => '
+'
+                      },
+                      'type' => 'line_arg'
+                    }
+                  ],
+                  'cmdname' => 'node',
+                  'extra' => {
+                    'node_content' => [
+                      {},
+                      {}
+                    ],
+                    'nodes_manuals' => [
+                      {
+                        'node_content' => [
+                          {},
+                          {}
+                        ],
+                        'normalized' => 'to-node1'
+                      }
+                    ],
+                    'normalized' => 'to-node1'
+                  },
+                  'info' => {
+                    'spaces_before_argument' => ' '
+                  },
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 7,
+                    'macro' => ''
+                  }
+                },
+                'node_argument' => {
+                  'node_content' => [
+                    {}
+                  ],
+                  'normalized' => 'to-node1'
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 5,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 5,
+        'macro' => ''
+      }
+    },
+    {}
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[3]{'extra'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[3]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[3]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[3]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[1]{'extra'}{'label'}
 = $result_trees{'double_recursive_self_section_node_reference'}{'contents'}[3];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[1]{'extra'}{'node_argument'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'extra'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'extra'}{'node_content'}[1]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[1];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'extra'}{'nodes_manuals'}[0]{'node_content'}[1]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[1];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'node_argument'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[5] = 
$result_trees{'double_recursive_self_section_node_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'};
+
+$result_texis{'double_recursive_self_section_node_reference'} = '@node Top
+@top top
+
+@node node1
+@chapter @ref{to node1}
+
+@node to @ref{node1}
+';
+
+
+$result_texts{'double_recursive_self_section_node_reference'} = 'top
+***
+
+1 to node1
+**********
+
+';
+
+$result_sectioning{'double_recursive_self_section_node_reference'} = {
+  'structure' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'top',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'Top'
+            },
+            'info' => {},
+            'structure' => {}
+          }
+        },
+        'info' => {},
+        'structure' => {
+          'section_childs' => [
+            {
+              'cmdname' => 'chapter',
+              'extra' => {
+                'associated_node' => {
+                  'cmdname' => 'node',
+                  'extra' => {
+                    'normalized' => 'node1'
+                  },
+                  'info' => {},
+                  'structure' => {}
+                }
+              },
+              'info' => {},
+              'structure' => {
+                'section_level' => 1,
+                'section_number' => 1,
+                'section_up' => {},
+                'toplevel_prev' => {},
+                'toplevel_up' => {}
+              }
+            }
+          ],
+          'section_level' => 0,
+          'section_up' => {}
+        }
+      }
+    ],
+    'section_level' => -1
+  }
+};
+$result_sectioning{'double_recursive_self_section_node_reference'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = 
$result_sectioning{'double_recursive_self_section_node_reference'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'double_recursive_self_section_node_reference'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_prev'}
 = 
$result_sectioning{'double_recursive_self_section_node_reference'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'double_recursive_self_section_node_reference'}{'structure'}{'section_childs'}[0]{'structure'}{'section_childs'}[0]{'structure'}{'toplevel_up'}
 = 
$result_sectioning{'double_recursive_self_section_node_reference'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'double_recursive_self_section_node_reference'}{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = $result_sectioning{'double_recursive_self_section_node_reference'};
+
+$result_nodes{'double_recursive_self_section_node_reference'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'associated_section' => {
+      'cmdname' => 'top',
+      'extra' => {},
+      'info' => {},
+      'structure' => {}
+    },
+    'normalized' => 'Top'
+  },
+  'info' => {},
+  'structure' => {
+    'node_next' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'chapter',
+          'extra' => {},
+          'info' => {},
+          'structure' => {
+            'section_number' => 1
+          }
+        },
+        'normalized' => 'node1'
+      },
+      'info' => {},
+      'structure' => {
+        'node_prev' => {},
+        'node_up' => {}
+      }
+    }
+  }
+};
+$result_nodes{'double_recursive_self_section_node_reference'}{'structure'}{'node_next'}{'structure'}{'node_prev'}
 = $result_nodes{'double_recursive_self_section_node_reference'};
+$result_nodes{'double_recursive_self_section_node_reference'}{'structure'}{'node_next'}{'structure'}{'node_up'}
 = $result_nodes{'double_recursive_self_section_node_reference'};
+
+$result_menus{'double_recursive_self_section_node_reference'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'Top'
+  },
+  'info' => {},
+  'structure' => {}
+};
+
+$result_errors{'double_recursive_self_section_node_reference'} = [
+  {
+    'error_line' => 'warning: @ref should not appear in @node
+',
+    'file_name' => '',
+    'line_nr' => 7,
+    'macro' => '',
+    'text' => '@ref should not appear in @node',
+    'type' => 'warning'
+  },
+  {
+    'error_line' => 'warning: @ref to `to node1\', different from node name 
`to @ref{node1}\'
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@ref to `to node1\', different from node name `to 
@ref{node1}\'',
+    'type' => 'warning'
+  }
+];
+
+
+$result_floats{'double_recursive_self_section_node_reference'} = {};
+
+
+
+$result_converted{'plaintext'}->{'double_recursive_self_section_node_reference'}
 = 'top
+***
+
+1 *note to *note node1::::
+**************************
+
+';
+
+$result_converted_errors{'plaintext'}->{'double_recursive_self_section_node_reference'}
 = [
+  {
+    'error_line' => 'warning: @ref node name should not contain `:\'
+',
+    'file_name' => '',
+    'line_nr' => 5,
+    'macro' => '',
+    'text' => '@ref node name should not contain `:\'',
+    'type' => 'warning'
+  }
+];
+
+
+
+$result_converted{'html'}->{'double_recursive_self_section_node_reference'} = 
'<!DOCTYPE html>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>top</title>
+
+<meta name="description" content="top">
+<meta name="keywords" content="top">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+<link href="#Top" rel="start" title="Top">
+
+
+</head>
+
+<body lang="en">
+<div class="top-level-extent" id="Top">
+<div class="nav-panel">
+<p>
+Next: <a href="#node1" accesskey="n" rel="next"><a class="ref" 
href="#to-node1">to <a class="ref" href="#node1">node1</a></a></a> &nbsp; </p>
+</div>
+<h1 class="top" id="top">top</h1>
+
+<ul class="mini-toc">
+<li><a href="#node1" accesskey="1"><a class="ref" href="#to-node1">to <a 
class="ref" href="#node1">node1</a></a></a></li>
+</ul>
+<hr>
+<div class="chapter-level-extent" id="node1">
+<div class="nav-panel">
+<p>
+Previous: <a href="#Top" accesskey="p" rel="prev">top</a>, Up: <a href="#Top" 
accesskey="u" rel="up">top</a> &nbsp; </p>
+</div>
+<h2 class="chapter" id="to-node1-1">1 <a class="ref" href="#to-node1">to <a 
class="ref" href="#node1">node1</a></a></h2>
+
+<hr>
+<a class="node-id" id="to-node1"></a><div class="nav-panel">
+<p>
+ &nbsp; </p>
+</div>
+<h4 class="node">to <a class="ref" href="#node1"><a class="ref" 
href="#to-node1">to <a class="ref" href="#node1">node1</a></a></a></h4>
+</div>
+</div>
+
+
+
+</body>
+</html>
+';
+
+1;
diff --git a/tp/t/results/sectioning/double_recursive_self_section_reference.pl 
b/tp/t/results/sectioning/double_recursive_self_section_reference.pl
new file mode 100644
index 0000000000..2b7fd45daa
--- /dev/null
+++ b/tp/t/results/sectioning/double_recursive_self_section_reference.pl
@@ -0,0 +1,397 @@
+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{'double_recursive_self_section_reference'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [],
+          'type' => 'preamble_before_content'
+        }
+      ],
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'n1'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'node_content' => [
+          {}
+        ],
+        'nodes_manuals' => [
+          {
+            'node_content' => [
+              {}
+            ],
+            'normalized' => 'n1'
+          }
+        ],
+        'normalized' => 'n1'
+      },
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'n2'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'ref',
+              'extra' => {
+                'label' => {
+                  'args' => [
+                    {
+                      'contents' => [
+                        {
+                          'text' => 'n2'
+                        }
+                      ],
+                      'info' => {
+                        'spaces_after_argument' => '
+'
+                      },
+                      'type' => 'line_arg'
+                    }
+                  ],
+                  'cmdname' => 'node',
+                  'extra' => {
+                    'node_content' => [
+                      {}
+                    ],
+                    'nodes_manuals' => [
+                      {
+                        'node_content' => [
+                          {}
+                        ],
+                        'normalized' => 'n2'
+                      }
+                    ],
+                    'normalized' => 'n2'
+                  },
+                  'info' => {
+                    'spaces_before_argument' => ' '
+                  },
+                  'source_info' => {
+                    'file_name' => '',
+                    'line_nr' => 4,
+                    'macro' => ''
+                  }
+                },
+                'node_argument' => {
+                  'node_content' => [
+                    {}
+                  ],
+                  'normalized' => 'n2'
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 2,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        }
+      ],
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 2,
+        'macro' => ''
+      }
+    },
+    {},
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'n1'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'ref',
+              'extra' => {
+                'label' => {},
+                'node_argument' => {
+                  'node_content' => [
+                    {}
+                  ],
+                  'normalized' => 'n1'
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 5,
+                'macro' => ''
+              }
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 5,
+        'macro' => ''
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'double_recursive_self_section_reference'}{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_reference'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_reference'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_reference'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'extra'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'label'}{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'node_argument'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+$result_trees{'double_recursive_self_section_reference'}{'contents'}[3] = 
$result_trees{'double_recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'label'};
+$result_trees{'double_recursive_self_section_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'label'}
 = $result_trees{'double_recursive_self_section_reference'}{'contents'}[1];
+$result_trees{'double_recursive_self_section_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'extra'}{'node_argument'}{'node_content'}[0]
 = 
$result_trees{'double_recursive_self_section_reference'}{'contents'}[4]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+
+$result_texis{'double_recursive_self_section_reference'} = '@node n1
+@chapter @ref{n2}
+
+@node n2
+@chapter @ref{n1}
+';
+
+
+$result_texts{'double_recursive_self_section_reference'} = '1 n2
+****
+
+2 n1
+****
+';
+
+$result_sectioning{'double_recursive_self_section_reference'} = {
+  'structure' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'chapter',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'n1'
+            },
+            'info' => {},
+            'structure' => {}
+          }
+        },
+        'info' => {},
+        'structure' => {
+          'section_level' => 1,
+          'section_number' => 1,
+          'section_up' => {}
+        }
+      },
+      {
+        'cmdname' => 'chapter',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'n2'
+            },
+            'info' => {},
+            'structure' => {}
+          }
+        },
+        'info' => {},
+        'structure' => {
+          'section_level' => 1,
+          'section_number' => 2,
+          'section_prev' => {},
+          'section_up' => {},
+          'toplevel_prev' => {}
+        }
+      }
+    ],
+    'section_level' => 0
+  }
+};
+$result_sectioning{'double_recursive_self_section_reference'}{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = $result_sectioning{'double_recursive_self_section_reference'};
+$result_sectioning{'double_recursive_self_section_reference'}{'structure'}{'section_childs'}[1]{'structure'}{'section_prev'}
 = 
$result_sectioning{'double_recursive_self_section_reference'}{'structure'}{'section_childs'}[0];
+$result_sectioning{'double_recursive_self_section_reference'}{'structure'}{'section_childs'}[1]{'structure'}{'section_up'}
 = $result_sectioning{'double_recursive_self_section_reference'};
+$result_sectioning{'double_recursive_self_section_reference'}{'structure'}{'section_childs'}[1]{'structure'}{'toplevel_prev'}
 = 
$result_sectioning{'double_recursive_self_section_reference'}{'structure'}{'section_childs'}[0];
+
+$result_nodes{'double_recursive_self_section_reference'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'associated_section' => {
+      'cmdname' => 'chapter',
+      'extra' => {},
+      'info' => {},
+      'structure' => {
+        'section_number' => 1
+      }
+    },
+    'normalized' => 'n1'
+  },
+  'info' => {},
+  'structure' => {
+    'node_next' => {
+      'cmdname' => 'node',
+      'extra' => {
+        'associated_section' => {
+          'cmdname' => 'chapter',
+          'extra' => {},
+          'info' => {},
+          'structure' => {
+            'section_number' => 2
+          }
+        },
+        'normalized' => 'n2'
+      },
+      'info' => {},
+      'structure' => {
+        'node_prev' => {}
+      }
+    }
+  }
+};
+$result_nodes{'double_recursive_self_section_reference'}{'structure'}{'node_next'}{'structure'}{'node_prev'}
 = $result_nodes{'double_recursive_self_section_reference'};
+
+$result_menus{'double_recursive_self_section_reference'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'n1'
+  },
+  'info' => {},
+  'structure' => {}
+};
+
+$result_errors{'double_recursive_self_section_reference'} = [];
+
+
+$result_floats{'double_recursive_self_section_reference'} = {};
+
+
+
+$result_converted{'plaintext'}->{'double_recursive_self_section_reference'} = 
'1 *note n2::
+************
+
+2 *note n1::
+************
+
+';
+
+
+$result_converted{'html'}->{'double_recursive_self_section_reference'} = 
'<!DOCTYPE html>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>Untitled Document</title>
+
+<meta name="description" content="Untitled Document">
+<meta name="keywords" content="Untitled Document">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+<link href="#n1" rel="start" title="n1">
+
+
+</head>
+
+<body lang="en">
+<div class="chapter-level-extent" id="n1">
+<div class="nav-panel">
+<p>
+Next: <a href="#n2" accesskey="n" rel="next"><a class="ref" href="#n1"><a 
class="ref" href="#n2">n2</a></a></a> &nbsp; </p>
+</div>
+<h2 class="chapter" id="n2-1">1 <a class="ref" href="#n2"><a class="ref" 
href="#n1"><a class="ref" href="#n2">n2</a></a></a></h2>
+
+<hr>
+</div>
+<div class="chapter-level-extent" id="n2">
+<div class="nav-panel">
+<p>
+Previous: <a href="#n1" accesskey="p" rel="prev"><a class="ref" 
href="#n2">n2</a></a> &nbsp; </p>
+</div>
+<h2 class="chapter" id="n1-1">2 <a class="ref" href="#n1"><a class="ref" 
href="#n2">n2</a></a></h2>
+</div>
+
+
+
+</body>
+</html>
+';
+
+$result_converted_errors{'html'}->{'double_recursive_self_section_reference'} 
= [
+  {
+    'error_line' => 'warning: must specify a title with a title command or @top
+',
+    'text' => 'must specify a title with a title command or @top',
+    'type' => 'warning'
+  }
+];
+
+
+1;
diff --git a/tp/t/results/sectioning/recursive_self_section_reference.pl 
b/tp/t/results/sectioning/recursive_self_section_reference.pl
new file mode 100644
index 0000000000..5cee0d9615
--- /dev/null
+++ b/tp/t/results/sectioning/recursive_self_section_reference.pl
@@ -0,0 +1,231 @@
+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{'recursive_self_section_reference'} = {
+  'contents' => [
+    {
+      'contents' => [
+        {
+          'contents' => [],
+          'type' => 'preamble_before_content'
+        }
+      ],
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'sharp'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'extra' => {
+        'node_content' => [
+          {}
+        ],
+        'nodes_manuals' => [
+          {
+            'node_content' => [
+              {}
+            ],
+            'normalized' => 'sharp'
+          }
+        ],
+        'normalized' => 'sharp'
+      },
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      }
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'sharp'
+                    }
+                  ],
+                  'type' => 'brace_command_arg'
+                }
+              ],
+              'cmdname' => 'ref',
+              'extra' => {
+                'label' => {},
+                'node_argument' => {
+                  'node_content' => [
+                    {}
+                  ],
+                  'normalized' => 'sharp'
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 2,
+                'macro' => ''
+              }
+            },
+            {
+              'text' => ' tuple'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => '
+'
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'chapter',
+      'extra' => {},
+      'info' => {
+        'spaces_before_argument' => ' '
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 2,
+        'macro' => ''
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+$result_trees{'recursive_self_section_reference'}{'contents'}[1]{'extra'}{'node_content'}[0]
 = 
$result_trees{'recursive_self_section_reference'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'recursive_self_section_reference'}{'contents'}[1]{'extra'}{'nodes_manuals'}[0]{'node_content'}[0]
 = 
$result_trees{'recursive_self_section_reference'}{'contents'}[1]{'args'}[0]{'contents'}[0];
+$result_trees{'recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'label'}
 = $result_trees{'recursive_self_section_reference'}{'contents'}[1];
+$result_trees{'recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'extra'}{'node_argument'}{'node_content'}[0]
 = 
$result_trees{'recursive_self_section_reference'}{'contents'}[2]{'args'}[0]{'contents'}[0]{'args'}[0]{'contents'}[0];
+
+$result_texis{'recursive_self_section_reference'} = '@node sharp
+@chapter @ref{sharp} tuple
+';
+
+
+$result_texts{'recursive_self_section_reference'} = '1 sharp tuple
+*************
+';
+
+$result_sectioning{'recursive_self_section_reference'} = {
+  'structure' => {
+    'section_childs' => [
+      {
+        'cmdname' => 'chapter',
+        'extra' => {
+          'associated_node' => {
+            'cmdname' => 'node',
+            'extra' => {
+              'normalized' => 'sharp'
+            },
+            'info' => {}
+          }
+        },
+        'info' => {},
+        'structure' => {
+          'section_level' => 1,
+          'section_number' => 1,
+          'section_up' => {}
+        }
+      }
+    ],
+    'section_level' => 0
+  }
+};
+$result_sectioning{'recursive_self_section_reference'}{'structure'}{'section_childs'}[0]{'structure'}{'section_up'}
 = $result_sectioning{'recursive_self_section_reference'};
+
+$result_nodes{'recursive_self_section_reference'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'associated_section' => {
+      'cmdname' => 'chapter',
+      'extra' => {},
+      'info' => {},
+      'structure' => {
+        'section_number' => 1
+      }
+    },
+    'normalized' => 'sharp'
+  },
+  'info' => {}
+};
+
+$result_menus{'recursive_self_section_reference'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'sharp'
+  },
+  'info' => {}
+};
+
+$result_errors{'recursive_self_section_reference'} = [];
+
+
+$result_floats{'recursive_self_section_reference'} = {};
+
+
+
+$result_converted{'plaintext'}->{'recursive_self_section_reference'} = '1 
*note sharp:: tuple
+*********************
+
+';
+
+
+$result_converted{'html'}->{'recursive_self_section_reference'} = '<!DOCTYPE 
html>
+<html>
+<!-- Created by texinfo, http://www.gnu.org/software/texinfo/ -->
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<title>Untitled Document</title>
+
+<meta name="description" content="Untitled Document">
+<meta name="keywords" content="Untitled Document">
+<meta name="resource-type" content="document">
+<meta name="distribution" content="global">
+<meta name="viewport" content="width=device-width,initial-scale=1">
+
+<link href="#sharp" rel="start" title="sharp">
+
+
+</head>
+
+<body lang="en">
+<div class="chapter-level-extent" id="sharp">
+<h2 class="chapter" id="sharp-tuple">1 <a class="ref" href="#sharp">sharp</a> 
tuple</h2>
+</div>
+
+
+
+</body>
+</html>
+';
+
+$result_converted_errors{'html'}->{'recursive_self_section_reference'} = [
+  {
+    'error_line' => 'warning: must specify a title with a title command or @top
+',
+    'text' => 'must specify a title with a title command or @top',
+    'type' => 'warning'
+  }
+];
+
+
+1;



reply via email to

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