[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[6454] remove quoting bytes from reference label
From: |
Gavin D. Smith |
Subject: |
[6454] remove quoting bytes from reference label |
Date: |
Thu, 23 Jul 2015 11:03:35 +0000 |
Revision: 6454
http://svn.sv.gnu.org/viewvc/?view=rev&root=texinfo&revision=6454
Author: gavin
Date: 2015-07-23 11:03:34 +0000 (Thu, 23 Jul 2015)
Log Message:
-----------
remove quoting bytes from reference label
Modified Paths:
--------------
trunk/ChangeLog
trunk/info/Makefile.am
trunk/info/info-utils.c
trunk/info/t/infodir/quoting.info
Added Paths:
-----------
trunk/info/t/quoted-manual-in-label.sh
trunk/info/t/quoted-manual-in-target.sh
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2015-07-23 09:24:03 UTC (rev 6453)
+++ trunk/ChangeLog 2015-07-23 11:03:34 UTC (rev 6454)
@@ -1,5 +1,14 @@
2015-07-23 Gavin Smith <address@hidden>
+ * info/info-utils.c (scan_reference_target): Remove quoting
+ characters from label.
+ (scan_reference_label): Handle case of a manual name appearing
+ in a label along with a quoted node name.
+ * info/t/quoted-manual-in-target.sh,
+ * info/t/quoted-manual-in-label.sh: New tests.
+
+2015-07-23 Gavin Smith <address@hidden>
+
* tp/Makefile.am: Reword comments about purpose of Makefile.tres
and Makefile.docstr.
Modified: trunk/info/Makefile.am
===================================================================
--- trunk/info/Makefile.am 2015-07-23 09:24:03 UTC (rev 6453)
+++ trunk/info/Makefile.am 2015-07-23 11:03:34 UTC (rev 6454)
@@ -155,6 +155,8 @@
t/quoted-label-as-target.sh \
t/quoted-target.sh \
t/quoted-label-and-target.sh \
+ t/quoted-manual-in-target.sh \
+ t/quoted-manual-in-label.sh \
t/goto-quoted.sh \
t/next-quoted.sh \
t/help.sh
Modified: trunk/info/info-utils.c
===================================================================
--- trunk/info/info-utils.c 2015-07-23 09:24:03 UTC (rev 6453)
+++ trunk/info/info-utils.c 2015-07-23 11:03:34 UTC (rev 6454)
@@ -1284,14 +1284,18 @@
scan_reference_label (REFERENCE *entry)
{
char *dummy;
- long label_len;
+ int label_len = 0;
+ /* Handle case of cross-reference like (FILE)^?NODE^?::. */
+ if (inptr[0] == '(')
+ label_len = read_bracketed_filename (inptr, 0);
+
/* Search forward to ":" to get label name. Cross-references may have
a newline in the middle. */
if (entry->type == REFERENCE_MENU_ITEM)
- label_len = read_quoted_string (inptr, ":", 1, &dummy);
+ label_len += read_quoted_string (inptr + label_len, ":", 1, &dummy);
else
- label_len = read_quoted_string (inptr, ":", 2, &dummy);
+ label_len += read_quoted_string (inptr + label_len, ":", 2, &dummy);
free (dummy);
if (label_len == 0)
@@ -1328,30 +1332,39 @@
scan_reference_target (REFERENCE *entry, NODE *node, int in_parentheses)
{
int i;
+ int label_len;
/* If this reference entry continues with another ':' then the target
of the reference is given by the label. */
if (*inptr == ':')
+ info_parse_node (entry->label);
+
+ label_len = strlen (entry->label);
+ if (label_len >= 2 && entry->label[label_len - 1] == 0177)
{
+ /* Remove the DEL bytes. We don't do this until after calling
+ info_parse_node so that ^?(FOO)BAR^?:: refers to a node called
+ "(FOO)BAR" within the current manual. */
+ char *p = strchr (entry->label, '\177');
+ memmove (p, p + 1, label_len - (p - entry->label) - 1);
+ entry->label[label_len - 2] = '\0';
+ }
+
+ if (*inptr == ':')
+ {
skip_input (1);
if (entry->type == REFERENCE_MENU_ITEM)
write_extra_bytes_to_output (" ", 1);
- info_parse_node (entry->label);
if (info_parsed_filename)
entry->filename = xstrdup (info_parsed_filename);
if (info_parsed_nodename)
entry->nodename = xstrdup (info_parsed_nodename);
- if (inptr[-1] == '\177')
- {
- /* TODO: Remove the DEL bytes. We don't do this until after calling
- info_parse_node so that ^?(FOO)BAR^?:: refers to a node called
- "(FOO)BAR" within the current manual. */
- }
return 1;
}
+
/* This entry continues with a specific target. Parse the
file name and node name from the specification. */
Modified: trunk/info/t/infodir/quoting.info
===================================================================
(Binary files differ)
Added: trunk/info/t/quoted-manual-in-label.sh
===================================================================
--- trunk/info/t/quoted-manual-in-label.sh (rev 0)
+++ trunk/info/t/quoted-manual-in-label.sh 2015-07-23 11:03:34 UTC (rev
6454)
@@ -0,0 +1,35 @@
+#!/bin/sh
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+srcdir=${srcdir:-.}
+. $srcdir/t/Init-test.inc
+. $t/Init-inter.inc
+
+run_ginfo -f quoting
+# Follow a cross-reference with a manual and quoted nodename in the label.
+printf '\t\t\t\t\t\r\t\rDq' >$PTY_TYPE
+. $t/Timeout-test.inc
+
+if test ! -f $GINFO_OUTPUT; then
+ RETVAL=1
+else
+ # Return non-zero (test failure) if files differ
+ diff $GINFO_OUTPUT $t/node-target
+ RETVAL=$?
+fi
+
+cleanup
+
Property changes on: trunk/info/t/quoted-manual-in-label.sh
___________________________________________________________________
Added: svn:executable
+ *
Added: trunk/info/t/quoted-manual-in-target.sh
===================================================================
--- trunk/info/t/quoted-manual-in-target.sh (rev 0)
+++ trunk/info/t/quoted-manual-in-target.sh 2015-07-23 11:03:34 UTC (rev
6454)
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Copyright (C) 2015 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+srcdir=${srcdir:-.}
+. $srcdir/t/Init-test.inc
+. $t/Init-inter.inc
+
+run_ginfo -f quoting
+# Follow a cross-reference with a manual and quoted nodename in the target,
+# after the colon.
+printf '\t\t\t\t\r\t\rDq' >$PTY_TYPE
+. $t/Timeout-test.inc
+
+if test ! -f $GINFO_OUTPUT; then
+ RETVAL=1
+else
+ # Return non-zero (test failure) if files differ
+ diff $GINFO_OUTPUT $t/node-target
+ RETVAL=$?
+fi
+
+cleanup
+
Property changes on: trunk/info/t/quoted-manual-in-target.sh
___________________________________________________________________
Added: svn:executable
+ *
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [6454] remove quoting bytes from reference label,
Gavin D. Smith <=