texinfo-commits
[Top][All Lists]
Advanced

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

branch master updated: ". " terminator for index entry node name


From: Gavin D. Smith
Subject: branch master updated: ". " terminator for index entry node name
Date: Mon, 30 Dec 2024 11:56:07 -0500

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

gavin pushed a commit to branch master
in repository texinfo.

The following commit(s) were added to refs/heads/master by this push:
     new cc9f6f66c2 ". " terminator for index entry node name
cc9f6f66c2 is described below

commit cc9f6f66c20ddb322921ed2ac2cad1fe863bc123
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Mon Dec 30 16:47:18 2024 +0000

    ". " terminator for index entry node name
    
    * info/scan.c (scan_reference_target):
    First check for a ". " and ".\n" terminator for node name in menu,
    rather than just a ".".  This allows index entries referring to
    nodes with "." in their names.  Report from Bruno Haible.
---
 ChangeLog   |  9 +++++++++
 info/scan.c | 38 ++++++++++++++++++++++++++++++++++++--
 2 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 26c3f93c53..330af30877 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-12-30  Gavin Smith <gavinsmith0123@gmail.com>
+
+       ". " terminator for index entry node name
+
+       * info/scan.c (scan_reference_target):
+       First check for a ". " and ".\n" terminator for node name in menu,
+       rather than just a ".".  This allows index entries referring to
+       nodes with "." in their names.  Report from Bruno Haible.
+
 2024-12-30  Gavin Smith <gavinsmith0123@gmail.com>
 
        * info/scan.c [__hpux]: remove define of __va_copy which isn't
diff --git a/info/scan.c b/info/scan.c
index fd5ec525b0..e27b32af83 100644
--- a/info/scan.c
+++ b/info/scan.c
@@ -1321,8 +1321,42 @@ scan_reference_target (REFERENCE *entry, NODE *node, int 
in_parentheses)
       length += strspn (inptr + length, " ");
 
       /* Get the node name. */
-      length += read_quoted_string (inptr + length, ",.\t\n", 2,
-                                    &entry->nodename);
+      entry->nodename = 0;
+      char *node_start = inptr + length;
+
+      /* First check for . followed by space or end of line. */
+      if (*node_start != '\x7f')
+        {
+          /* Confine search to present line. */
+          char *nl = strchr (node_start, '\n');
+          if (nl)
+            *nl = '\0';
+
+          char *node_end = strstr (node_start, ". ");
+          if (!node_end)
+            {
+              /* Check for . at end of line. */
+              if (nl && nl > node_start && nl[-1] == '.')
+                node_end = &nl[-1];
+            }
+
+          if (nl)
+            *nl = '\n';
+
+          if (node_end)
+            {
+              entry->nodename = xmalloc (node_end - node_start + 1);
+              memcpy (entry->nodename, node_start,
+                      node_end - node_start);
+              entry->nodename[node_end - node_start] = '\0';
+              length += node_end - node_start;
+            }
+        }
+      if (!entry->nodename)
+        {
+          length += read_quoted_string (inptr + length, ",.\t\n", 2,
+                                        &entry->nodename);
+        }
       if (inptr[length] == '.') /* A '.' terminating the entry. */
         length++;
       canonicalize_whitespace (entry->nodename);



reply via email to

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