groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 07/10: [tbl]: Accept `\&` as an empty table entry.


From: G. Branden Robinson
Subject: [groff] 07/10: [tbl]: Accept `\&` as an empty table entry.
Date: Wed, 10 Nov 2021 09:23:44 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 72255cc224dfd9365b9e5377e6ed66047db02f36
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Wed Nov 10 12:22:11 2021 +1100

    [tbl]: Accept `\&` as an empty table entry.
    
    * src/preproc/tbl/table.cpp (table::add_entry): Suppress diagnostic
      about non-empty table entries classified as `_` or `=` if the entry
      consists of exactly `\&`.
    
    * src/preproc/tbl/tbl.1.man (Table data): Document this idiom.
    
    This behavior change is intended as an ergonomic aid for those who use
    the default tab character and whose text editors don't make tabs visible
    (as can be done with Vim's 'list' option).  It is consistent with other
    tbl and *roff usage of this token, which does not represent anything
    visible or printable.
---
 ChangeLog                 | 10 ++++++++++
 src/preproc/tbl/table.cpp |  4 ++--
 src/preproc/tbl/tbl.1.man |  5 +++++
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index dc26a12..8bcd6cf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2021-11-10  G. Branden Robinson <g.branden.robinson@gmail.com>
 
+       [tbl]: Accept `\&` as an empty table entry.
+
+       * src/preproc/tbl/table.cpp (table::add_entry): Suppress
+       diagnostic about non-empty table entries classified as `_` or
+       `=` if the entry consists of exactly `\&`.
+
+       * src/preproc/tbl/tbl.1.man (Table data): Document this idiom.
+
+2021-11-10  G. Branden Robinson <g.branden.robinson@gmail.com>
+
        [tbl]: Update diagnostic messages.
 
        * src/preproc/tbl/main.cpp (process_options, process_format):
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index efcbf63..6b16625 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -1623,14 +1623,14 @@ void table::add_entry(int r, int c, const string &str,
       do_vspan(r, c);
       break;
     case FORMAT_HLINE:
-      if (str.length() != 0)
+      if ((str.length() != 0) && (str != "\\&"))
        error_with_file_and_line(fn, ln,
                                 "ignoring non-empty data entry using"
                                 " '_' column classifier");
       e = new single_line_entry(this, f);
       break;
     case FORMAT_DOUBLE_HLINE:
-      if (str.length() != 0)
+      if ((str.length() != 0) && (str != "\\&"))
        error_with_file_and_line(fn, ln,
                                 "ignoring non-empty data entry using"
                                 " '=' column classifier");
diff --git a/src/preproc/tbl/tbl.1.man b/src/preproc/tbl/tbl.1.man
index 055fdda..5eb7d32 100644
--- a/src/preproc/tbl/tbl.1.man
+++ b/src/preproc/tbl/tbl.1.man
@@ -885,6 +885,11 @@ Within such data lines, items are normally separated by 
tab characters
 .B tab
 option).
 .
+If you wish to visibly mark an empty table entry in the document source,
+populate it with the
+.B \[rs]&
+non-printing input token.
+.
 Long input lines can be broken across multiple lines if the last
 character on the line is \[lq]\[rs]\[rq]
 (which vanishes after



reply via email to

[Prev in Thread] Current Thread [Next in Thread]