source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Quirk-compatibility with GNU tbl(1): With the "nospaces" option,
@ 2021-09-10 13:25 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2021-09-10 13:25 UTC (permalink / raw)
  To: source

Log Message:
-----------
Quirk-compatibility with GNU tbl(1):
With the "nospaces" option, skip space characters before and after "T{",
in addition to skipping those at the beginning and end of data cells.

Minor issue reported by <Oliver dot Corff at email dot de>.

Modified Files:
--------------
    mandoc:
        tbl_data.c

Revision Data
-------------
Index: tbl_data.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/tbl_data.c,v
retrieving revision 1.58
retrieving revision 1.59
diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.58 -r1.59
--- tbl_data.c
+++ tbl_data.c
@@ -147,25 +147,28 @@ getdata(struct tbl_node *tbl, struct tbl
 		dp->last->next = dat;
 	dp->last = dat;
 
+	/* Strip leading and trailing spaces, if requested. */
+
+	endpos = *pos;
+	if (dp->opts->opts & TBL_OPT_NOSPACE) {
+		while (p[startpos] == ' ')
+			startpos++;
+		while (endpos > startpos && p[endpos - 1] == ' ')
+			endpos--;
+	}
+
 	/*
 	 * Check for a continued-data scope opening.  This consists of a
 	 * trailing `T{' at the end of the line.  Subsequent lines,
 	 * until a standalone `T}', are included in our cell.
 	 */
 
-	if (*pos - startpos == 2 &&
+	if (endpos - startpos == 2 &&
 	    p[startpos] == 'T' && p[startpos + 1] == '{') {
 		tbl->part = TBL_PART_CDATA;
 		return;
 	}
 
-	endpos = *pos;
-	if (dp->opts->opts & TBL_OPT_NOSPACE) {
-		while (p[startpos] == ' ')
-			startpos++;
-		while (endpos > startpos && p[endpos - 1] == ' ')
-			endpos--;
-	}
 	dat->string = mandoc_strndup(p + startpos, endpos - startpos);
 
 	if (p[*pos] != '\0')
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-10 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10 13:25 mandoc: Quirk-compatibility with GNU tbl(1): With the "nospaces" option, schwarze

source@mandoc.bsd.lv

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/mandoc-source

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 mandoc-source mandoc-source/ https://inbox.vuxu.org/mandoc-source \
		source@mandoc.bsd.lv
	public-inbox-index mandoc-source

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git