From 4ef9c2b48f9fcdc5b8c347367566a987a9893aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Thu, 24 Jun 2021 10:55:19 +0200 Subject: README.t: Add PDF bookmarks, links --- Makefile | 7 +++++-- README.t | 37 ++++++++++++++++++++++++++++++++++++- t/Makefile | 7 +++++-- toc/Makefile | 6 ++++-- 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.pdf + 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.pdf + README.pdf example.pdf: example.t toc.tmac toc - example.pdf + example.pdf -- cgit v1.2.3