user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] doc: "check-man" target to ensure we stay <=80 cols
@ 2019-10-15 20:19 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2019-10-15 20:19 UTC (permalink / raw)
  To: meta

This should prevent future documentation changes from exceeding
the limit of standard terminals.
---
 Documentation/include.mk | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/Documentation/include.mk b/Documentation/include.mk
index 9fd85210..3a73ae84 100644
--- a/Documentation/include.mk
+++ b/Documentation/include.mk
@@ -10,6 +10,7 @@ RSYNC = rsync
 RSYNC_DEST = public-inbox.org:/srv/public-inbox/
 MAN = man
 XMLSTARLET = xmlstarlet
+AWK = awk
 
 # same as pod2text
 COLUMNS = 76
@@ -58,7 +59,9 @@ man8 := $(addsuffix .8, $(m8))
 
 all:: man html
 
-man: $(man1) $(man5) $(man7) $(man8)
+manpages = $(man1) $(man5) $(man7) $(man8)
+
+man: $(manpages)
 
 prefix ?= $(PREFIX)
 prefix ?= $(HOME)
@@ -83,6 +86,19 @@ doc_install :: install-man
 %.1 %.5 %.7 %.8 : Documentation/%.pod
 	$(podman) -s $(subst .,,$(suffix $@)) $< $@+ && mv $@+ $@
 
+# n.b. not sure if our usage of man(1) is portable or not, so not
+# enabled by default "check" target:
+# check :: check-man
+check_man = @echo CHECK80 $<;COLS=80 $(MAN) ./$^ | \
+	$(AWK) 'length>80{print;err=1}END{exit(err)}' >&2
+
+%.1.cols : %.1; $(check_man)
+%.5.cols : %.5; $(check_man)
+%.7.cols : %.7; $(check_man)
+%.8.cols : %.8; $(check_man)
+
+check-man :: $(addsuffix .cols, $(manpages))
+
 manuals :=
 manuals += $(m1)
 manuals += $(m5)

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-10-15 20:19 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 20:19 [PATCH] doc: "check-man" target to ensure we stay <=80 cols Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).