tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: "Anthony J. Bentley" <anthony@anjbe.name>
Cc: tech@mandoc.bsd.lv
Subject: Re: Comments within tables
Date: Sat, 9 Feb 2019 17:05:32 +0100	[thread overview]
Message-ID: <20190209160532.GC37934@athene.usta.de> (raw)
In-Reply-To: <16677.1549668230@desktop.ajb.soy>

Hi Anthony,

Anthony J. Bentley wrote on Fri, Feb 08, 2019 at 04:23:50PM -0700:

> Just noticed this while playing around.
> 
> .TS
> box;
> n n n n.
> .\"_    _       _       _
> 2173    77.1    13765   53.6
> .\"=    =       =       =
> .TE
> 
> groff:
> 
> +---------------------------+
> |2173   77.1   13765   53.6 |
> +---------------------------+
> 
> mandoc:
> 
> +---------------------------+
> | .                         |
> |2173   77.1   13765   53.6 |
> | .                         |
> +---------------------------+

True, fixed in the commit below.

Care was needed to not break this earlier commit to roff.c:

revision 1.124
date: 2015/01/21 02:16:11;  author: schwarze;  state: Exp;  lines: +10 -11
pass empty request lines through to tbl(7); sometimes, they end a layout

Yours,
  Ingo


Log Message:
-----------
ignore empty request lines in the table data reader;
fixing a minibug reported by bentley@

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.51
retrieving revision 1.52
diff -Ltbl_data.c -Ltbl_data.c -u -p -r1.51 -r1.52
--- tbl_data.c
+++ tbl_data.c
@@ -1,7 +1,7 @@
 /*	$Id$ */
 /*
  * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
- * Copyright (c) 2011, 2015, 2017, 2018 Ingo Schwarze <schwarze@openbsd.org>
+ * Copyright (c) 2011,2015,2017,2018,2019 Ingo Schwarze <schwarze@openbsd.org>
  *
  * Permission to use, copy, modify, and distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -248,14 +248,27 @@ tbl_data(struct tbl_node *tbl, int ln, c
 
 	assert(rp != NULL);
 
-	if ( ! strcmp(p, "_")) {
-		sp = newspan(tbl, ln, rp);
-		sp->pos = TBL_SPAN_HORIZ;
-		return;
-	} else if ( ! strcmp(p, "=")) {
-		sp = newspan(tbl, ln, rp);
-		sp->pos = TBL_SPAN_DHORIZ;
-		return;
+	if (p[1] == '\0') {
+		switch (p[0]) {
+		case '.':
+			/*
+			 * Empty request lines must be handled here
+			 * and cannot be discarded in roff_parseln()
+			 * because in the layout section, they
+			 * are significant and end the layout.
+			 */
+			return;
+		case '_':
+			sp = newspan(tbl, ln, rp);
+			sp->pos = TBL_SPAN_HORIZ;
+			return;
+		case '=':
+			sp = newspan(tbl, ln, rp);
+			sp->pos = TBL_SPAN_DHORIZ;
+			return;
+		default:
+			break;
+		}
 	}
 
 	/*
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

      reply	other threads:[~2019-02-09 16:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 23:23 Anthony J. Bentley
2019-02-09 16:05 ` Ingo Schwarze [this message]

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=20190209160532.GC37934@athene.usta.de \
    --to=schwarze@usta.de \
    --cc=anthony@anjbe.name \
    --cc=tech@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).