Hello Branden,

Ingo Schwarze wrote on Wed, Sep 09, 2026 at 06:54:39PM +0200:
> G. Branden Robinson wrote on Tue, Sep 08, 2026 at 11:33:08PM -0500:

>> That established, I think the balance of factors is likely in favor of
>> having _man_(7)'s (and _mdoc_(7)'s) `TS` macro unconditionally break,

> OK, good.  Consequently, for now, i will make mandoc(1) do that.
> That will almost certainly be easy to do in mandoc and pose no danger.
> Should it later turn out that despite initial appearances, there is a
> downside to doing it in groff, too, that can be revisited in mandoc.

Done, see the commit and credits below.
  Ingo


Log Message:
-----------
Render an empty tbl(7) table as an output line break and not
as a 1v vertical space like in groff-1.22.4 because groff-1.23
stopped emitting vertical space around tables in general.

G. Branden Robinson agrees that this new behaviour probably makes
the most sense and that groff_man(7) and groff_mdoc(7) should
probably follow in the future by having .TS imply .br, even though
from groff-1.23.0 to groff-1.25.0, yet another behaviour was
implemented, where an empty table printed nothing whatsoever,
not even an output line break.

While here, modernise the code in roff_TE() by using the
internal node creation API from "roff_int.h" rather than
the old, heavy-handed ROFF_REPARSE method.

Small formatting issue found while working on
regression tests for the fix of a bug found by
Hippolyte Doncieu de la Batie <[email protected]>.

Modified Files:
--------------
    mandoc:
        roff.c
    mandoc/regress/tbl/data:
        empty.out_ascii

Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/roff.c,v
diff -Lroff.c -Lroff.c -u -p -r1.408 -r1.409
--- roff.c
+++ roff.c
@@ -3339,11 +3339,10 @@ roff_TE(ROFF_ARGS)
        if (r->tbl == NULL)
                mandoc_msg(MANDOCERR_BLK_NOTOPEN, ln, ppos, "TE");
        else if (roff_endtbl(r, 0) == 0) {
-               free(buf->buf);
-               buf->buf = mandoc_strdup(".sp");
-               buf->sz = 4;
-               *offs = 0;
-               return ROFF_REPARSE;
+               roff_elem_alloc(r->man, ln, ppos, ROFF_br);
+               r->man->last->flags |=
+                   NODE_LINE | NODE_NOSRC | NODE_VALID | NODE_ENDED;
+               r->man->next = ROFF_NEXT_SIBLING;
        }
        return ROFF_IGN;
 }
Index: empty.out_ascii
===================================================================
RCS file: /home/cvs/mandoc/mandoc/regress/tbl/data/empty.out_ascii,v
diff -Lregress/tbl/data/empty.out_ascii -Lregress/tbl/data/empty.out_ascii -u 
-p -r1.5 -r1.6
--- regress/tbl/data/empty.out_ascii
+++ regress/tbl/data/empty.out_ascii
@@ -5,7 +5,6 @@ NNAAMMEE
 
 DDEESSCCRRIIPPTTIIOONN
      normal text
-
      normal text
 
 OpenBSD                        January 28, 2015              TBL-DATA-EMPTY(1)

Reply via email to