source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Quirk-compatibility with GNU tbl(1): With the "nospaces" option,
Date: Fri, 10 Sep 2021 08:25:08 -0500 (EST)	[thread overview]
Message-ID: <c2aabd5d09eb498f@mandoc.bsd.lv> (raw)

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


                 reply	other threads:[~2021-09-10 13:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c2aabd5d09eb498f@mandoc.bsd.lv \
    --to=schwarze@mandoc.bsd.lv \
    --cc=source@mandoc.bsd.lv \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).