----- Forwarded message from Paul Eggert <egg...@cs.ucla.edu> ----- Date: Thu, 28 Aug 2025 12:18:08 -0700 From: Paul Eggert <egg...@cs.ucla.edu> To: "G. Branden Robinson" <g.branden.robin...@gmail.com> Cc: Time zone mailing list <t...@iana.org> Message-ID: <8f674e3f-694c-4cd8-ad06-9a33ddbd4...@cs.ucla.edu> User-Agent: Mozilla Thunderbird Subject: Re: Disabling adjustment, hyphenation, SGR, and page headers and footers in man pages
On 2025-08-27 16:42, G. Branden Robinson wrote: > I sent this to t...@iana.org a few days ago, but it appears to have gotten > discarded, maybe because I am not subscribed to the list. Yes, it's August and I suspect mailing list reviewers are on vacation. For tz list readers: Branden's original email is archived here: https://lists.gnu.org/r/groff/2025-08/msg00041.html > I have a suggestion for accomplishing all of the tasks named in the > Subject with command-line options to (recent) nroff. If I understand > the "workman.sh" script correctly, all that would be left for your > pipeline is to strip a trailing blank line. Thanks for the suggestion. As TZDB has been shipping *.txt files with single header and trailer lines for some time, I think we can simply prefer that style now for groff; this removes the need to strip a trailing blank line. For traditional nroff the best we can easily do is omit all headers and trailers, to avoid irritating headers elsewhere. > You might find it more convenient to use command-line options than to > append to macro definitions and otherwise inject *roff into nroff's > input stream (which is interpreted only after the macro package is > loaded, a fact that will have important consequences in groff 1.24). Thanks for the suggestion. Although this assumes groff we can do it just for groff (and for mandoc) and continue to do things the traditional way on old-fashioned (by now, very old-fashioned) hosts. I installed the attached proposed patches to implement your suggestion and a bit more. ----- End forwarded message -----
From 4fd80135e8e4b14a2ccf06ed5ff10454d0dd6bce Mon Sep 17 00:00:00 2001 From: Paul Eggert <egg...@cs.ucla.edu> Date: Thu, 28 Aug 2025 08:20:16 -0700 Subject: [PROPOSED 1/2] Fix .Ql in newstrftime man page * newstrftime.3: Fix a stray unportable .Ql that should be .q. (Problem reported by G. Branden Robinson.) --- newstrftime.3 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newstrftime.3 b/newstrftime.3 index e9a38224..182f44f7 100644 --- a/newstrftime.3 +++ b/newstrftime.3 @@ -74,7 +74,7 @@ string consists of zero or more conversion specifications and ordinary characters. All ordinary characters are copied directly into the array. A conversion specification consists of a percent sign -.Ql % +.q % and one other character. .PP No more than -- 2.48.1
From 657288a08cb1e1fe38f1cfcf350f2e328bcd7130 Mon Sep 17 00:00:00 2001 From: Paul Eggert <egg...@cs.ucla.edu> Date: Thu, 28 Aug 2025 08:45:51 -0700 Subject: [PROPOSED 2/2] Formatted man pages (*.txt) now use UTF-8 (Inspired by G. Branden Robinson.) * Makefile (MANFLAGS): New macro. (MANTXTS): Use it. * NEWS: Mention this. * workman.sh (manflags): New var. Accumulate options into it, and pass them to groff and to mandoc. Try groff first and use -dAD=l -rHY=0 -mtty-char as well when using groff. Fall back on traditional nroff last, after mdoc. When trying groff, make sure all the flags work, so that we do not use old groff such as the groff 1.16.1 (2000) shipped with Solaris 10 and still supported. Use "$@" rather than ${1+"$@"} as we no longer need to port to pre-POSIX shells that lack "$@". --- Makefile | 8 +++++++- NEWS | 5 +++++ workman.sh | 38 +++++++++++++++++++++----------------- 3 files changed, 33 insertions(+), 18 deletions(-) diff --git a/Makefile b/Makefile index 99407112..7d77da60 100644 --- a/Makefile +++ b/Makefile @@ -219,6 +219,12 @@ PACKRATLIST= UTF8_LOCALE= en_US.utf8 +# Extra flags for producing man page files like tzfile.5.txt. +# These flags are used only if groff (or mandoc) is present. +# Each option should begin with "-" and should lack shell metacharacters. +# Plausible options include -Tascii and -Tutf8. +MANFLAGS= -Tutf8 + # Non-default libraries needed to link. # On some hosts, this should have -lintl unless CFLAGS has -DHAVE_GETTEXT=0. LDLIBS= @@ -1075,7 +1081,7 @@ zdump.8.txt: zdump.8 zic.8.txt: zic.8 $(MANTXTS): workman.sh - LC_ALL=C sh workman.sh $(@:.txt=) >$@.out + LC_ALL=C sh workman.sh $(MANFLAGS) $(@:.txt=) >$@.out mv $@.out $@ # Set file timestamps deterministically if possible, diff --git a/NEWS b/NEWS index a7916e69..9163c1fe 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,11 @@ Unreleased, experimental changes reproducible timestamps. Formerly, only the contents of the compressed tarballs had reproducible timestamps. + By default, distributed formatted man pages (*.txt) now use UTF-8 + and are left-adjusted more consistently. A new Makefile macro + MANFLAGS can override these defaults. (Thanks to G. Branden + Robinson for inspiring these changes.) + Changes to commentary The leapseconds file contains commentary about the IERS and NIST diff --git a/workman.sh b/workman.sh index ad1a9532..91621b10 100644 --- a/workman.sh +++ b/workman.sh @@ -4,29 +4,35 @@ # This file is in the public domain, so clarified as of # 2009-05-17 by Arthur David Olson. -if (type nroff && type perl) >/dev/null 2>&1; then - - # Tell groff not to emit SGR escape sequences (ANSI color escapes). - export GROFF_NO_SGR=1 +manflags= +while + case $1 in + -*) :;; + *) false;; + esac +do + manflags="$manflags $1" + shift +done +groff="groff -dAD=l -rHY=0 $manflags -mtty-char -man -ww -P-bcou" +if ($groff) </dev/null >/dev/null 2>&1; then + $groff "$@" +elif (type mandoc && type col) >/dev/null 2>&1; then + mandoc $manflags -man "$@" | col -bx +elif (type nroff && type perl) >/dev/null 2>&1; then printf '%s\n' '. -.\" -- Tailor groff -man -- -. -.\" Left-adjust and do not hyphenate. -.ds AD l -.nr HY 0 -. -.\" -- Tailor traditional troff -man -- -. .\" Left-adjust and do not hyphenate. .am TH .na .hy 0 .. -.\" Omit page headers and footers. +.\" Omit internal page headers and footers. +.\" Unfortunately this also omits the starting header and ending footer, +.\" but that is the best old nroff can easily do. .rm }H .rm }F -.' | nroff -man - ${1+"$@"} | perl -ne ' +.' | nroff -man - "$@" | perl -ne ' binmode STDIN, '\'':encoding(utf8)'\''; binmode STDOUT, '\'':encoding(utf8)'\''; chomp; @@ -44,9 +50,7 @@ if (type nroff && type perl) >/dev/null 2>&1; then $didprint = 1; } ' -elif (type mandoc && type col) >/dev/null 2>&1; then - mandoc -man -T ascii "$@" | col -bx else - echo >&2 "$0: please install nroff and perl, or mandoc and col" + echo >&2 "$0: please install groff, or mandoc and col" exit 1 fi -- 2.48.1
signature.asc
Description: PGP signature