tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
* Comments within tables
@ 2019-02-08 23:23 Anthony J. Bentley
  2019-02-09 16:05 ` Ingo Schwarze
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony J. Bentley @ 2019-02-08 23:23 UTC (permalink / raw)
  To: tech

Hi,

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 |
| .                         |
+---------------------------+

-- 
Anthony J. Bentley
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Comments within tables
  2019-02-08 23:23 Comments within tables Anthony J. Bentley
@ 2019-02-09 16:05 ` Ingo Schwarze
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Schwarze @ 2019-02-09 16:05 UTC (permalink / raw)
  To: Anthony J. Bentley; +Cc: tech

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-09 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-08 23:23 Comments within tables Anthony J. Bentley
2019-02-09 16:05 ` Ingo Schwarze

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).