texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: * tp/Texinfo/XS/parsetexi/menus.c (handle_menu):


From: Patrice Dumas
Subject: branch master updated: * tp/Texinfo/XS/parsetexi/menus.c (handle_menu): start a node entry only if the * is at the beginning of a line, as for the perl parser.
Date: Thu, 02 Mar 2023 08:33:56 -0500

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

pertusus pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new 942ab56519 * tp/Texinfo/XS/parsetexi/menus.c (handle_menu): start a 
node entry only if the * is at the beginning of a line, as for the perl parser.
942ab56519 is described below

commit 942ab56519945563b3d7a5dda2c9ca7c44f881c7
Author: Patrice Dumas <pertusus@free.fr>
AuthorDate: Thu Mar 2 14:33:42 2023 +0100

    * tp/Texinfo/XS/parsetexi/menus.c (handle_menu): start a node entry
    only if the * is at the beginning of a line, as for the perl parser.
    
    * tp/Makefile.tres, tp/t/10menu.t: add leading_space_before_menu_star test.
---
 ChangeLog                                          |   7 +
 tp/Makefile.tres                                   |   1 +
 tp/Texinfo/XS/parsetexi/menus.c                    |   3 +-
 tp/t/10menu.t                                      |   7 +
 .../results/menu/leading_space_before_menu_star.pl | 226 +++++++++++++++++++++
 5 files changed, 243 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index c6362b7dcf..17dca23855 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2023-03-02  Patrice Dumas  <pertusus@free.fr>
+
+       * tp/Texinfo/XS/parsetexi/menus.c (handle_menu): start a node entry
+       only if the * is at the beginning of a line, as for the perl parser.
+
+       * tp/Makefile.tres, tp/t/10menu.t: add leading_space_before_menu_star 
test.
+
 2023-03-02  Patrice Dumas  <pertusus@free.fr>
 
        * tp/Texinfo/ParserNonXS.pm (_process_remaining_on_line),
diff --git a/tp/Makefile.tres b/tp/Makefile.tres
index 2493e80ad4..1a497e348a 100644
--- a/tp/Makefile.tres
+++ b/tp/Makefile.tres
@@ -1321,6 +1321,7 @@ test_files_generated_list = 
$(test_tap_files_generated_list) \
   t/results/menu/formats_in_menu.pl \
   t/results/menu/inlineraw_in_menu_description.pl \
   t/results/menu/invalid_info_menu_entry.pl \
+  t/results/menu/leading_space_before_menu_star.pl \
   t/results/menu/menu_entry_name.pl \
   t/results/menu/menu_entry_name_comment.pl \
   t/results/menu/menu_entry_no_entry.pl \
diff --git a/tp/Texinfo/XS/parsetexi/menus.c b/tp/Texinfo/XS/parsetexi/menus.c
index 18013175aa..600af4efd0 100644
--- a/tp/Texinfo/XS/parsetexi/menus.c
+++ b/tp/Texinfo/XS/parsetexi/menus.c
@@ -113,7 +113,8 @@ handle_menu (ELEMENT **current_inout, char **line_inout)
       && (current->parent->type == ET_menu_comment
           || current->parent->type == ET_menu_entry_description)
       && current->contents.number > 0
-      && last_contents_child(current)->type == ET_empty_line)
+      && last_contents_child(current)->type == ET_empty_line
+      && last_contents_child(current)->text.end == 0)
     {
       ELEMENT *star;
 
diff --git a/tp/t/10menu.t b/tp/t/10menu.t
index 200298fbb1..72904664b2 100644
--- a/tp/t/10menu.t
+++ b/tp/t/10menu.t
@@ -69,6 +69,13 @@ Horizontal space
 * a: (f)b3.c. d
 @end menu
 '],
+['leading_space_before_menu_star',
+'@node a node
+
+@menu
+ * a node::
+@end menu
+'],
 ['menu_entry_name_comment',
 '@menu
 * a: (f)b@c c
diff --git a/tp/t/results/menu/leading_space_before_menu_star.pl 
b/tp/t/results/menu/leading_space_before_menu_star.pl
new file mode 100644
index 0000000000..edfdc8061f
--- /dev/null
+++ b/tp/t/results/menu/leading_space_before_menu_star.pl
@@ -0,0 +1,226 @@
+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{'leading_space_before_menu_star'} = {
+  'contents' => [
+    {
+      'type' => 'before_node_section'
+    },
+    {
+      'args' => [
+        {
+          'contents' => [
+            {
+              'text' => 'a node'
+            }
+          ],
+          'info' => {
+            'spaces_after_argument' => {
+              'text' => '
+'
+            }
+          },
+          'type' => 'line_arg'
+        }
+      ],
+      'cmdname' => 'node',
+      'contents' => [
+        {
+          'text' => '
+',
+          'type' => 'empty_line'
+        },
+        {
+          'args' => [
+            {
+              'info' => {
+                'spaces_after_argument' => {
+                  'text' => '
+'
+                }
+              },
+              'type' => 'block_line_arg'
+            }
+          ],
+          'cmdname' => 'menu',
+          'contents' => [
+            {
+              'contents' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => ' * a node::
+'
+                    }
+                  ],
+                  'type' => 'preformatted'
+                }
+              ],
+              'type' => 'menu_comment'
+            },
+            {
+              'args' => [
+                {
+                  'contents' => [
+                    {
+                      'text' => 'menu'
+                    }
+                  ],
+                  'info' => {
+                    'spaces_after_argument' => {
+                      'text' => '
+'
+                    }
+                  },
+                  'type' => 'line_arg'
+                }
+              ],
+              'cmdname' => 'end',
+              'extra' => {
+                'text_arg' => 'menu'
+              },
+              'info' => {
+                'spaces_before_argument' => {
+                  'text' => ' '
+                }
+              },
+              'source_info' => {
+                'file_name' => '',
+                'line_nr' => 5,
+                'macro' => ''
+              }
+            }
+          ],
+          'source_info' => {
+            'file_name' => '',
+            'line_nr' => 3,
+            'macro' => ''
+          }
+        }
+      ],
+      'extra' => {
+        'normalized' => 'a-node'
+      },
+      'info' => {
+        'spaces_before_argument' => {
+          'text' => ' '
+        }
+      },
+      'source_info' => {
+        'file_name' => '',
+        'line_nr' => 1,
+        'macro' => ''
+      }
+    }
+  ],
+  'type' => 'document_root'
+};
+
+$result_texis{'leading_space_before_menu_star'} = '@node a node
+
+@menu
+ * a node::
+@end menu
+';
+
+
+$result_texts{'leading_space_before_menu_star'} = '
+ * a node::
+';
+
+$result_nodes{'leading_space_before_menu_star'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'menus' => [
+      {
+        'cmdname' => 'menu'
+      }
+    ],
+    'normalized' => 'a-node'
+  },
+  'info' => {}
+};
+
+$result_menus{'leading_space_before_menu_star'} = {
+  'cmdname' => 'node',
+  'extra' => {
+    'normalized' => 'a-node'
+  },
+  'info' => {}
+};
+
+$result_errors{'leading_space_before_menu_star'} = [];
+
+
+$result_floats{'leading_space_before_menu_star'} = {};
+
+
+
+$result_converted{'plaintext'}->{'leading_space_before_menu_star'} = '* Menu:
+
+ * a node::
+';
+
+
+$result_converted{'html'}->{'leading_space_before_menu_star'} = '<!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="#a-node" rel="start" title="a node">
+<style type="text/css">
+<!--
+a.copiable-link {visibility: hidden; text-decoration: none; line-height: 0em}
+pre.menu-comment-preformatted {font-family: serif}
+span:hover a.copiable-link {visibility: visible}
+th.menu-comment {text-align:left}
+-->
+</style>
+
+
+</head>
+
+<body lang="en">
+<h4 class="node" id="a-node"><span>a node<a class="copiable-link" 
href="#a-node"> &para;</a></span></h4>
+
+<table class="menu" border="0" cellspacing="0">
+<tr><th class="menu-comment" colspan="3"><pre 
class="menu-comment-preformatted"> * a node::
+</pre></th></tr></table>
+
+
+
+</body>
+</html>
+';
+
+$result_converted_errors{'html'}->{'leading_space_before_menu_star'} = [
+  {
+    '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'
+  }
+];
+
+
+
+$result_converted{'xml'}->{'leading_space_before_menu_star'} = '<node 
name="a-node" spaces=" "><nodename>a node</nodename></node>
+
+<menu endspaces=" ">
+<menucomment><pre xml:space="preserve"> * a node::
+</pre></menucomment></menu>
+';
+
+1;



reply via email to

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