Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/distrib/notes Improve table of contents.
details: https://anonhg.NetBSD.org/src/rev/3efac3a5480c
branches: trunk
changeset: 846732:3efac3a5480c
user: uwe <uwe%NetBSD.org@localhost>
date: Sat Nov 30 00:28:27 2019 +0000
description:
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).
diffstat:
distrib/notes/Makefile.inc | 12 +++-------
distrib/notes/common/macros | 51 +++++++++++++++++++++++++++++++++++++-------
2 files changed, 47 insertions(+), 16 deletions(-)
diffs (120 lines):
diff -r ad6779d0b49c -r 3efac3a5480c distrib/notes/Makefile.inc
--- a/distrib/notes/Makefile.inc Sat Nov 30 00:02:15 2019 +0000
+++ b/distrib/notes/Makefile.inc Sat Nov 30 00:28:27 2019 +0000
@@ -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 <ross%NetBSD.org@localhost>
@@ -103,9 +103,9 @@
${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}.ASCII.toc: ${SRCS}
${TOOL_GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} > /dev/null
mv -f $@.tmp $@
- ${TOOL_GROFF} -dTOC=1 ${ARGS_TXT} -mdoc ${MAIN} > /dev/null
- mv -f $@.tmp $@
${TARG}.HTML.toc: ${SRCS}
${TOOL_GROFF} -dTOC=1 ${ARGS_HTML} -mdoc ${MAIN} > /dev/null
@@ -126,8 +124,6 @@
${TARG}.more.toc: ${SRCS}
${TOOL_GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} > /dev/null
mv -f $@.tmp $@
- ${TOOL_GROFF} -dTOC=1 ${ARGS_MORE} -mdoc ${MAIN} > /dev/null
- mv -f $@.tmp $@
release: check_RELEASEDIR .WAIT ${TARGS}
diff -r ad6779d0b49c -r 3efac3a5480c distrib/notes/common/macros
--- a/distrib/notes/common/macros Sat Nov 30 00:02:15 2019 +0000
+++ b/distrib/notes/common/macros Sat Nov 30 00:28:27 2019 +0000
@@ -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 HTML
-.ie rHTML \{\
+.
+.\" .Tc and .Ti for PostScript
+.
+.ie '\*[format]'PostScript' \{\
.de Ti
-\h'3n*\\$1u' <a href="#\\$3">\\$3</a>
+.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
+.
+.el .ie rHTML \{\
+.de Ti
+.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
Home |
Main Index |
Thread Index |
Old Index