Module Name: src
Committed By: uwe
Date: Sat Nov 30 00:28:27 UTC 2019
Modified Files:
src/distrib/notes: Makefile.inc
src/distrib/notes/common: macros
Log Message:
Improve table of contents.
For .txt and .more drop meaningless page numbers, those formats are
not paginated (with all due respect to line printers, 80s are over).
For .ps use actual formatting with proportional font and properly
aligned page numbers. Thanks to kre@ for his help with some of the
darker corners of troff (with all due respect to my 80s self, he/I
should have paid more attention).
To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/distrib/notes/Makefile.inc
cvs rdiff -u -r1.53 -r1.54 src/distrib/notes/common/macros
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/distrib/notes/Makefile.inc
diff -u src/distrib/notes/Makefile.inc:1.51 src/distrib/notes/Makefile.inc:1.52
--- src/distrib/notes/Makefile.inc:1.51 Thu Nov 28 00:06:39 2019
+++ src/distrib/notes/Makefile.inc Sat Nov 30 00:28:27 2019
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.51 2019/11/28 00:06:39 uwe Exp $
+# $NetBSD: Makefile.inc,v 1.52 2019/11/30 00:28:27 uwe Exp $
#
# Ross Harvey <[email protected]>
@@ -103,9 +103,9 @@ ${TARG}.more: ${SRCS} ${TOC.more} ${DIST
${TOOL_GROFF} ${ARGS_MORE} -mdoc ${MAIN} > $@
-# Rules to build the table of contents (.toc) files.
-# They are generated twice to take into account the
-# space taken by the TOC itself.
+# Rules to build the table of contents (.toc) files. For the
+# PostScript version it's generated twice to take into account the
+# space taken by the TOC itself. Other versions are not paginated.
${TARG}.PostScript.toc: ${SRCS}
${TOOL_GROFF} -dTOC=1 ${ARGS_PS} -mdoc ${MAIN} > /dev/null
@@ -116,8 +116,6 @@ ${TARG}.PostScript.toc: ${SRCS}
${TARG}.ASCII.toc: ${SRCS}
${TOOL_GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} > /dev/null
mv -f [email protected] $@
- ${TOOL_GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} > /dev/null
- mv -f [email protected] $@
${TARG}.HTML.toc: ${SRCS}
${TOOL_GROFF} -dTOC=1 ${ARGS_HTML} -mdoc ${MAIN} > /dev/null
@@ -126,8 +124,6 @@ ${TARG}.HTML.toc: ${SRCS}
${TARG}.more.toc: ${SRCS}
${TOOL_GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} > /dev/null
mv -f [email protected] $@
- ${TOOL_GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} > /dev/null
- mv -f [email protected] $@
release: check_RELEASEDIR .WAIT ${TARGS}
Index: src/distrib/notes/common/macros
diff -u src/distrib/notes/common/macros:1.53 src/distrib/notes/common/macros:1.54
--- src/distrib/notes/common/macros:1.53 Fri Nov 29 16:33:44 2019
+++ src/distrib/notes/common/macros Sat Nov 30 00:28:27 2019
@@ -1,4 +1,4 @@
-.\" $NetBSD: macros,v 1.53 2019/11/29 16:33:44 uwe Exp $
+.\" $NetBSD: macros,v 1.54 2019/11/30 00:28:27 uwe Exp $
.\"
.\" Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -342,11 +342,42 @@
.if rHTML <a name="\\$*"></a>
.if dTOC .mktoc \\n[To-toc-level] \\$@
..
+.
+.\" .Tc and .Ti for PostScript
+.
+.ie '\*[format]'PostScript' \{\
+.de Ti
+.nr Ti-toc-level \\$1
+.nr Ti-page \\$2
+.shift 2
+.nr Ti-indent (\\n[Tc-saved-indent]+(3n*\\n[Ti-toc-level]))
+.in \\n[Ti-indent]u
+\\$* \c
+'nr Ti-eol-pos (\\n(.l-\\n(.i-\\n(.k)
+'ta (\\n[Ti-eol-pos]u-\w'099'u)R (\\n[Ti-eol-pos]u)R
+\a\t\\n[Ti-page]
+.br
+..
+.
+.de Tc
+.nr Tc-saved-indent \\n(.i
+.tm ...reading \*[toc-file]
+.\" Use so-real here because toc-file is in objdir not .CURDIR
+.so-real \*[toc-file]
+.in \\n[Tc-saved-indent]u
+..
+.\}
+.
.\" .Tc and .Ti for HTML
-.ie rHTML \{\
+.
+.el .ie rHTML \{\
.de Ti
-\h'3n*\\$1u' <a href="#\\$3">\\$3</a>
+.nr Ti-toc-level \\$1
+.\"nr Ti-page \\$2
+.shift 2
+\h'3n*\\n[Ti-toc-level]u' <a href="#\\$*">\\$*</a>
..
+.
.de Tc
.tm ...reading \*[toc-file]
.nf
@@ -355,16 +386,20 @@
.fi
..
.\}
-.\" .Tc and .Ti for text and postscript
+.
+.\" .Tc and .Ti for unpaginated text
+.
.el \{\
.de Ti
-\h'3n*\\$1u' \\$3\a\\$2
+.nr Ti-toc-level \\$1
+.\"nr Ti-page \\$2
+.shift 2
+\h'3n*\\n[Ti-toc-level]u'\\$*
+.br
..
.de Tc
.Bd -literal
-.ta (\n(.lu)R
.tm ...reading \*[toc-file]
-. Pp
.\" Use so-real here because toc-file is in objdir not .CURDIR
.so-real \*[toc-file]
.Ed