groff-commit
[Top][All Lists]
Advanced

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

[groff] 02/12: [tbl]: If "nowarn", suppress table row warning.


From: G. Branden Robinson
Subject: [groff] 02/12: [tbl]: If "nowarn", suppress table row warning.
Date: Sat, 20 Nov 2021 05:19:09 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 45aeaeb06899b21e5615aa910c3d58ac4e728ea7
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Nov 15 17:10:18 2021 +1100

    [tbl]: If "nowarn", suppress table row warning.
    
    * src/preproc/tbl/table.cpp (table::init_output): Bracket the generated
      groff code that emits a warning if a table row overruns a page
      location trap (usually, is too long to vertically fit on the page) in
      a test for whether the "nowarn" region option was given, so that this
      warning is suppressed as well when that option is used.
    * src/preproc/tbl/tbl.1.man (Region options): Document new "nowarn"
      behavior.
    
    ("nokeep" also suppresses this warning, for a different reason; no
    diversion is created to hold the table row, so its vertical size does
    not exist to be compared to the distance to the next page trap.)
    
    Fixes <https://savannah.gnu.org/bugs/?61477>.
    
    You can generate a document to test with the following.
    
    (printf '.TS\nL.\nT{\n.nf\n'; seq 1 71; printf 'T}\n.TE\n') > foo.roff
---
 ChangeLog                 | 20 ++++++++++++++++++++
 src/preproc/tbl/table.cpp | 22 ++++++++++++----------
 src/preproc/tbl/tbl.1.man |  5 +----
 3 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 25ca47d..2f45131 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,26 @@
        * src/devices/gropdf/gropdf.pl: Fixes to importing pdf versions
        > 1.4.
 
+2021-11-15  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [tbl]: If "nowarn", suppress table row warning.
+
+       * src/preproc/tbl/table.cpp (table::init_output): Bracket the
+       generated groff code that emits a warning if a table row
+       overruns a page location trap (usually, is too long to
+       vertically fit on the page) in a test for whether the "nowarn"
+       region option was given, so that this warning is suppressed as
+       well when that option is used.
+       * src/preproc/tbl/tbl.1.man (Region options): Document new
+       "nowarn" behavior.
+
+       {"nokeep" also suppresses this warning, for a different reason;
+       no diversion is created to hold the table row, so its vertical
+       size does not exist to be compared to the distance to the next
+       page trap.}
+
+       Fixes <https://savannah.gnu.org/bugs/?61477>.
+
 2021-11-13  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/preproc/tbl/table.cpp (table::do_vspan): Fix code style
diff --git a/src/preproc/tbl/table.cpp b/src/preproc/tbl/table.cpp
index 444333c..46f1c1c 100644
--- a/src/preproc/tbl/table.cpp
+++ b/src/preproc/tbl/table.cpp
@@ -1846,7 +1846,7 @@ void table::init_output()
         ".\\}\n"
         ".\\}\n"
         "..\n");
-  if (!(flags & NOKEEP))
+  if (!(flags & NOKEEP)) {
     prints(".de " KEEP_MACRO_NAME "\n"
           ".if '\\n[.z]'' \\{.ds " QUOTE_STRING_NAME " \\\\\n"
           ".ds " TRANSPARENT_STRING_NAME " \\!\n"
@@ -1876,15 +1876,16 @@ void table::init_output()
           ".sp \\n[.t]u\n"
           ".nr " SUPPRESS_BOTTOM_REG " 0\n"
           ".mk #T\n"
-          ".\\}\n"
-          ".if \\n[.t]<=\\n[" SAVED_DN_REG "] \\{\\\n"
-          /* Since we turn off traps, it won't get into an infinite
-             loop when we try and print it; it will just go off the
-             bottom of the page. */
-          ".  tmc \\n[.F]: around line \\n[.c]: warning:\n"
-          ".  tm1 \" table row will not fit on page \\n%\n"
-          ".\\}\n"
-          ".nf\n"
+          ".\\}\n");
+    if (!(flags & NOWARN))
+      prints(".if \\n[.t]<=\\n[" SAVED_DN_REG "] \\{\\\n"
+            /* Since we turn off traps, it won't get into an infinite
+               loop when we try and print it; it will just go off the
+               bottom of the page. */
+            ".  tmc \\n[.F]: around line \\n[.c]: warning:\n"
+            ".  tm1 \" table row will not fit on page \\n%\n"
+            ".\\}\n");
+    prints(".nf\n"
           ".if \\n[.nm] .if \\n[ln] .nm \\n[ln]\n"
           ".nr " ROW_MAX_LINE_REG " \\n[ln]\n"
           ".ls 1\n"
@@ -1929,6 +1930,7 @@ void table::init_output()
           ".nr ln \\n[" ROW_MAX_LINE_REG "]\n"
           ".\\}\n"
           "..\n");
+  }
   prints(".ec\n"
         ".ce 0\n"
         ".nf\n");
diff --git a/src/preproc/tbl/tbl.1.man b/src/preproc/tbl/tbl.1.man
index 8a24fd2..c2d4ee3 100644
--- a/src/preproc/tbl/tbl.1.man
+++ b/src/preproc/tbl/tbl.1.man
@@ -352,10 +352,7 @@ This is a GNU extension.
 .TP
 .B nowarn
 Suppress diagnostic messages produced at document formatting time when
-the
-line length is
-.\" TODO: line or page lengths are (Savannah #61477)
-inadequate to contain a table row.
+the line or page lengths are inadequate to contain a table row.
 .
 This is a GNU extension.
 .



reply via email to

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