bug-groff
[Top][All Lists]
Advanced

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

[bug #61379] [*.tmac] Detect use of preprocessor "tbl" and "table wider


From: G. Branden Robinson
Subject: [bug #61379] [*.tmac] Detect use of preprocessor "tbl" and "table wider than line"
Date: Wed, 27 Oct 2021 23:15:35 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0

Update of bug #61379 (project groff):

                  Status:                    None => In Progress            
             Assigned to:                    None => gbranden               

    _______________________________________________________

Follow-up Comment #1:

I think some of this is a good idea.

1. I agree that it's helpful to tell the user that they forgot to run tbl, and
TW is a pretty reliable proxy for that (or for a very serious error in tbl
itself).

2. I don't agree that we should abort processing over this.  Failed table
rendering is pretty ugly, but ugliness is not a fatal problem.

3. That said, if a document has multiple tables, this diagnostic should not be
reported over and over again.

4. I'm leaning away from including information about the table being wider
than the line length.  Doesn't tbl already emit diagnostics in this case?  I'm
pretty sure I've seen them.

Here's my first cut at applying this (modified) idea to an.tmac.  The
diagnostic message is pretty long, but especially for man(1) users I want to
be helpful without fibbing to them.  I tested it and it seems okay.

(On the bright side, as I recall, Colin Watson's man-db is coded such that it
_always_ calls groff with `-t`, so this diagnostic should only appear if there
is a terrible tbl failure, or people are trying to render man pages with a
troff command (or a wrapper) themselves, in which case I'm not disturbed by
the idea of dumping this much info on them.)


diff --git a/tmac/an.tmac b/tmac/an.tmac
index ff6fc977f..de399e954 100644
--- a/tmac/an.tmac
+++ b/tmac/an.tmac
@@ -905,6 +905,16 @@
 .de1 TE
 .  HTML-IMAGE-END
 .  if \\n[an-is-output-html] .ll \\n[an-TS-ll]u
+.  if !r TW \{\
+.    if !r an-was-tbl-failure-reported \{\
+.      ds an-msg tbl preprocessor failed or was not run;\"
+.      as an-msg " table(s) likely not rendered\"
+.      as an-msg " (TE macro called with TW register undefined)\"
+.      an-warn \\*[an-msg]
+.      rm an-msg
+.      nr an-was-tbl-failure-reported 1
+.    \}
+.  \}
 ..
 .
 .\" eqn(1) equation support


This works fine in testing.  I may chain the .ifs in the version I push. 
Feedback welcome.

If this experiment is a success, we can adapt it to the other full-service
packages (modulus mom, which is Peter's bailiwick, though he is of course
welcome to delegate).

    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?61379>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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