[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Warn about long lines
From: |
Alejandro Colomar |
Subject: |
Re: Warn about long lines |
Date: |
Fri, 26 Aug 2022 20:51:15 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 |
Hi Ralph,
On 8/26/22 08:18, Ralph Corderoy wrote:
Hi Alejandro,
$ true | (! grep '^.\{80\}.' 81); echo $?
.................................................................................
1
$
May I tell groff(1) (grotty(1)) that the terminal width is 80, no
matter what it actually is?
grotty(1) doesn't decide where to split the line, it happens earlier
than that, so you want to affect groff(1).
Otherwise, I can only run the above in <=80-col terminals.
I don't have the command you're running.
The following is in <lib/lint-man.mk>:
[[
TMACFILES := $(shell $(FIND) $(TMACDIR) -not -type d | $(SORT))
TMACNAMES := $(basename $(notdir $(TMACFILES)))
GROFF_CHECKSTYLE_LVL := 3
DEFAULT_GROFFFLAGS := -man
DEFAULT_GROFFFLAGS += -t
DEFAULT_GROFFFLAGS += -M $(TMACDIR)
DEFAULT_GROFFFLAGS += $(foreach x,$(TMACNAMES),-m $(x))
DEFAULT_GROFFFLAGS += -rCHECKSTYLE=$(GROFF_CHECKSTYLE_LVL)
DEFAULT_GROFFFLAGS += -ww
DEFAULT_GROFFFLAGS += -Tascii
EXTRA_GROFFFLAGS :=
GROFFFLAGS := $(DEFAULT_GROFFFLAGS) $(EXTRA_GROFFFLAGS)
GROFF := groff
$(_LINT_man_groff): $(_LINTDIR)/%.lint-man.groff.touch: $(MANDIR)/% |
$$(@D)/.
$(info LINT (groff) $@)
$(GROFF) $(GROFFFLAGS) $< \
| sed 's/\x1b\[[^@-~]*[@-~]//g' \
| (! grep -n '.\{80\}.')
touch $@
]]
which in the end produces:
$ make lint-man-groff V=1
LINT (groff) tmp/lint/man3/confstr.3.lint-man.groff.touch
groff -man -t -M ./etc/groff/tmac -m checkstyle -rCHECKSTYLE=3 \
-ww -Tascii man3/confstr.3 \
| sed 's/\x1b\[[^@-~]*[@-~]//g' \
| (! grep -n '.\{80\}.')
touch tmp/lint/man3/confstr.3.lint-man.groff.touch
- If it's man(1) then see if it supports $MANWIDTH or $COLUMNS.
I knew about this one.
- If it's groff, then use ā-rLL=80nā; see groff_man(7).
Ahh, this is what I needed. I sometimes struggle to understand how
groff divides the implementation. Why is LL only documented in
(implemented for?) groff_man(7)? I wouldn't have expected it there. It
doesn't seem like a man(7)-specific thing (it may be implemented for
-man only, but that seems non-obvious to me). I mean, when searching
for an option that controls the line length, I expect it to be a generic
option that will be applicable to groff as a whole, and not to a
specific macro set. I fail to find documentation about these things for
that reason.
I searched for /column /length /width in groff(1) and found nothing. :/
$ (echo .TH a b c d; seq 314) |
> groff -ww -Tutf8 -man -rLL=80n |
> awk '{print length}' |
> uniq -c
1 80
3 0
14 80
1 23
3 0
1 80
$
Thanks!
Cheers,
Alex
--
Alejandro Colomar
<http://www.alejandro-colomar.es/>
OpenPGP_signature
Description: OpenPGP digital signature
- Warn about long lines, Alejandro Colomar, 2022/08/21
- Re: Warn about long lines, Ralph Corderoy, 2022/08/22
- Re: Warn about long lines, Alejandro Colomar, 2022/08/22
- Re: Warn about long lines, Ralph Corderoy, 2022/08/23
- Re: Warn about long lines, Alejandro Colomar, 2022/08/23
- Re: Warn about long lines, Ralph Corderoy, 2022/08/23
- Re: Warn about long lines, Alejandro Colomar, 2022/08/24
- Re: Warn about long lines, Alejandro Colomar, 2022/08/25
- Re: Warn about long lines, Ralph Corderoy, 2022/08/26
- Re: Warn about long lines,
Alejandro Colomar <=
- Re: Warn about long lines, Ingo Schwarze, 2022/08/27
- Re: Warn about long lines, Ralph Corderoy, 2022/08/27
- Re: Warn about long lines, Alejandro Colomar, 2022/08/27
- Re: Warn about long lines, G. Branden Robinson, 2022/08/27
- Re: Warn about long lines, Alejandro Colomar, 2022/08/28
- Re: Warn about long lines, G. Branden Robinson, 2022/08/28
- Re: Warn about long lines, Ralph Corderoy, 2022/08/28
- Re: Warn about long lines, Alejandro Colomar, 2022/08/28
- Re: Warn about long lines, Ralph Corderoy, 2022/08/29
Re: Warn about long lines, Ingo Schwarze, 2022/08/24