aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-06-24 10:55:19 +0200
committerJohn Ankarström <john@ankarstrom.se>2021-06-24 13:51:58 +0200
commit4ef9c2b48f9fcdc5b8c347367566a987a9893aa2 (patch)
treeabc418a0d9022740e78514951fa4e806eb9bee2d
parent36528d22c7a609d5e981fca3d7429048140ccca2 (diff)
downloadmk-4ef9c2b48f9fcdc5b8c347367566a987a9893aa2.tar.gz
README.t: Add PDF bookmarks, links
-rw-r--r--Makefile7
-rw-r--r--README.t37
-rw-r--r--t/Makefile7
-rw-r--r--toc/Makefile6
4 files changed, 50 insertions, 7 deletions
diff --git a/Makefile b/Makefile
index 485c8e3..cfdab83 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,12 @@
+TROFF ?= troff
+PDFROFF ?= troff | dpost | ps2pdf -
+
all: README.pdf hacking.pdf
hacking.pdf: hacking.t g.tmac
perl -pe '$$_=`$$_` if s/^\!//' hacking.t |\
- troff -x3 | dpost | ps2pdf - > hacking.pdf
+ $(PDFROFF) > hacking.pdf
README.pdf: README.t g.tmac
TROFFONTS=/usr/pkg/share/fonts/X11/TTF/ \
- <README.t toc/toc troff -x3 | dpost | ps2pdf - > README.pdf
+ <README.t toc/toc $(PDFROFF) > README.pdf
diff --git a/README.t b/README.t
index 83b076e..e8337c6 100644
--- a/README.t
+++ b/README.t
@@ -1,9 +1,43 @@
.so g.tmac
.so gx.tmac
.so toc/toc.tmac
-.papersize letter
+.mediasize letter
.fp 0 M DejaVuSansMono ttf
.
+.eo
+.de he
+. nr a +1
+. h
+\X'PDFMark: Bookmark 0 \\$*'\A'\na'
+. br
+. sp -1
+\$*
+. te .the \na \n% \$*
+..
+.
+.de se
+. nr a +1
+. s
+\X'PDFMark: Bookmark 1 \\$*'\A'\na'
+. br
+. sp -1
+\$*
+. te .the \na \n% \\h'18p'\$*
+..
+.
+.\" the -- toc entry
+.de the
+. nr _a \$1
+. nr _p \$2
+. shift 2
+. ta \n(.luR
+. tc .
+\T'\n(_a'\$* \n(_p\T
+. tc
+. br
+..
+.ec
+.
.\" configure header and footer
.eo
.de @h
@@ -37,6 +71,7 @@ John Ankarström
.i "TABLE OF CONTENTS"
.sp 4p
.@e
+\X'SetLinkBorder: 0 0 0'\c
.to
.sp 0.5i
.ns
diff --git a/t/Makefile b/t/Makefile
index f278324..49eaac5 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -1,6 +1,9 @@
.SUFFIXES: .t .T .pdf
TEST != ls *.t | sed 's/t$$/T/'
+TROFF ?= troff
+PDFROFF ?= troff | dpost | ps2pdf -
+
all: $(TEST)
g.tmac: ../g.tmac
@@ -9,7 +12,7 @@ g.tmac: ../g.tmac
.t.T: g.tmac t.tmac
@echo -- $< -----------------------
- @troff -x3 $< >/dev/null
+ @<$< $(TROFF) >/dev/null
.t.pdf: g.tmac t.tmac
- troff -x3 $< | dpost | ps2pdf - > $@
+ <$< $(PDFROFF) > $@
diff --git a/toc/Makefile b/toc/Makefile
index d6d2a6e..2cc92ac 100644
--- a/toc/Makefile
+++ b/toc/Makefile
@@ -1,5 +1,7 @@
+TROFF ?= groff -Tps
+
README.pdf: README.t toc.tmac toc
- <README.t ./toc groff -Tps | ps2pdf - > README.pdf
+ <README.t ./toc $(TROFF) | ps2pdf - > README.pdf
example.pdf: example.t toc.tmac toc
- <example.t ./toc groff -Tps | ps2pdf - > example.pdf
+ <example.t ./toc $(TROFF) | ps2pdf - > example.pdf