texinfo-commits
[Top][All Lists]
Advanced

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

[5475] handle newline in reference target


From: Gavin D. Smith
Subject: [5475] handle newline in reference target
Date: Tue, 22 Apr 2014 20:06:36 +0000

Revision: 5475
          http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=5475
Author:   gavin
Date:     2014-04-22 20:06:35 +0000 (Tue, 22 Apr 2014)
Log Message:
-----------
handle newline in reference target

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/info/info-utils.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog     2014-04-22 18:41:22 UTC (rev 5474)
+++ trunk/ChangeLog     2014-04-22 20:06:35 UTC (rev 5475)
@@ -1,5 +1,11 @@
 2014-04-22  Gavin Smith  <address@hidden>
 
+       * info/info-utils.c (scan_reference_target): Better handling
+       of case when a newline appears within a reference specification.
+       (info_parse_node): Skip newlines at start of specification.
+
+2014-04-22  Gavin Smith  <address@hidden>
+
        * info/info-utils.c (degrade_utf8): Replacements added for more
        characters spotted in documents.
 

Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c     2014-04-22 18:41:22 UTC (rev 5474)
+++ trunk/info/info-utils.c     2014-04-22 20:06:35 UTC (rev 5475)
@@ -87,7 +87,10 @@
   if (!string || !*string)
     return;
 
-  length = skip_whitespace (string);
+  if (flag != PARSE_NODE_DFLT)
+    length = skip_whitespace_and_newlines (string);
+  else  
+    length = skip_whitespace (string);
   string += length;
 
   /* Check for (FILENAME)NODENAME. */
@@ -1126,8 +1129,15 @@
       else
         {
           char saved_char;
+          char *nl_off;
 
           length = info_parse_node (inptr, PARSE_NODE_SKIP_NEWLINES);
+
+          /* Check if there is a newline in the target. */
+          saved_char = inptr[length];
+          inptr[length] = '\0';
+          nl_off = strchr (inptr, '\n');
+          inptr[length] = saved_char;
           
           if (info_parsed_filename)
             {
@@ -1140,11 +1150,25 @@
 
           /* A full stop terminating a reference should be output,
              but a comma is usually? not. */
-          /* FIXME: do this more generally, I seem to remember? */
           if (inptr[length - 1] == '.')
             skip_input (length - 1);
           else
             skip_input (length);
+
+          /* We often have a closing bracket or a full stop after a
+             cross reference, so output these before the optional newline. */
+          if (inptr[0] == '.' && inptr[1] == ')')
+            copy_input_to_output (2);
+          else if (*inptr == ')' || *inptr == '.')
+            copy_input_to_output (1);
+
+          if (nl_off)
+            { 
+              int i, j = skip_whitespace (nl_off + 1);
+              write_extra_bytes_to_output ("\n", 1);
+              for (i = 0; i < j; i++)
+                write_extra_bytes_to_output (" ", 1);
+            }
         }
 
       if (info_parsed_filename)




reply via email to

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