groff
[Top][All Lists]
Advanced

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

Re: Warn about long lines


From: Ingo Schwarze
Subject: Re: Warn about long lines
Date: Wed, 24 Aug 2022 14:18:21 +0200

Hi Alejandro,

Alejandro Colomar wrote on Mon, Aug 22, 2022 at 12:31:15AM +0200:

> Would you mind adding a warning about this?
> 
> I'm currently doing a global fix in the Linux man-pages turning kernel 
> types like __u64 into the standard uint64_t that user-space programmers 
> expect.  Most of these are used within structure definitions, and so 
> they are within .EX/.EE (non-filled).  I fear that I might be making one 
> of those structure definitions go past the right margin, and there are 
> so many, that it's not funny rendering all of them to check; not even 
> only those that I suspect that might; especially, since some may be 
> deeply indented in .RS/.RE blocks that I may not notice (and that 
> happened at least once --in one that I checked, luckily--).

That is an interesting idea.  I certainly see how it could be useful
for users, without having to run an additional tool or command.

It may not be easy to implement in a useful way, though.
The obvious first idea is to issue the warning in the terminal
formatter, which is part of the program that already does output
column counting.  That, however, would be confusing because "mandoc
-Tlint" never invokes any formatter, so the warning would *not* appear
in its output, nor would it affect the exit code.  If implemented in
the formatter, getting the warning would require a command similar to

  mandoc -T ascii -W all > /dev/null

which i don't really want to recommend.

For now, i am adding this entry to the mandoc TODO file:

 - warn about output lines exceeding 80 characters
   Alejandro Colomar Aug 22, 2022
   not trivial because -T lint does not call any formatter
   loc ***  exist *  algo **  size **  imp **

No guarantee whether or when it can be done.

For the time being, i suggest this workaround:

   $ cd /co/linux-man-pages/
   $ for f in man?/*; do mandoc $f | col -b | grep -E '.{80}' && echo $f; done
  ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)
  man7/uri.7

  ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress
  ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)
  man7/url.7

  ldap://ldap.itd.umich.edu/o=University%20of%20Michigan,c=US?postalAddress
  ldap://host.com:6666/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)
  man7/urn.7

  Rule    US      1967    1973    -       Apr    lastSun    2:00w    1:00d    D
  man8/zic.8

> $ cat longline.man
> .TH a b c d
> .SH foo
> .nf
> this is a very long line that will go past the 80-col right margin, and 
> I want to be warned about it.

Don't worry, Thunderbird hates everyone, not you specifically.
I do wonder why so many use it anyway, though.

Yours,
  Ingo



reply via email to

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