SMOLNET PORTAL home about changes
iAvoid orphans in PDF. - tgtimes - The Gopher Times	Err	bitreich.org	70
hgit clone git://bitreich.org/tgtimes git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tgtimes	URL:git://bitreich.org/tgtimes git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tgtimes	bitreich.org	70
1Log	/scm/tgtimes/log.gph	bitreich.org	70
1Files	/scm/tgtimes/files.gph	bitreich.org	70
1Refs	/scm/tgtimes/refs.gph	bitreich.org	70
1Tags	/scm/tgtimes/tag	bitreich.org	70
1README	/scm/tgtimes/file/README.md.gph	bitreich.org	70
i---	Err	bitreich.org	70
1commit 1002873261d2894759c9e5854cfdf7568ad8e29e	/scm/tgtimes/commit/1002873261d2894759c9e5854cfdf7568ad8e29e.gph	bitreich.org	70
1parent c09232171a4703120c1aa9af28c3ae6b3f3a6f36	/scm/tgtimes/commit/c09232171a4703120c1aa9af28c3ae6b3f3a6f36.gph	bitreich.org	70
hAuthor: Troels Henriksen <athas@sigkill.dk>	URL:mailto:athas@sigkill.dk	bitreich.org	70
iDate:   Tue,  8 Aug 2023 22:14:14 +0200	Err	bitreich.org	70
i	Err	bitreich.org	70
iAvoid orphans in PDF.	Err	bitreich.org	70
i	Err	bitreich.org	70
iSigned-off-by: Christoph Lohmann <20h@r-36.net>	Err	bitreich.org	70
i	Err	bitreich.org	70
iDiffstat:	Err	bitreich.org	70
i  M Makefile                            |       2 +-	Err	bitreich.org	70
i  A filters/nudge.filter                |      28 ++++++++++++++++++++++++++++	Err	bitreich.org	70
i	Err	bitreich.org	70
i2 files changed, 29 insertions(+), 1 deletion(-)	Err	bitreich.org	70
i---	Err	bitreich.org	70
1diff --git a/Makefile b/Makefile	/scm/tgtimes/file/Makefile.gph	bitreich.org	70
i@@ -38,7 +38,7 @@ rawptxtfiles=${rawfiles:.raw=.ptxt}	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ${tgtimes}.txt: ${mdptxtfiles} ${txtptxtfiles} ${rawptxtfiles}	Err	bitreich.org	70
i-        cat opus${v}/?-*.ptxt > ${tgtimes}.txt	Err	bitreich.org	70
i+        cat opus${v}/?-*.ptxt | filters/nudge.filter > ${tgtimes}.txt	Err	bitreich.org	70
i 	Err	bitreich.org	70
i 	Err	bitreich.org	70
i ${tgtimes}.pdf: ${tgtimes}.txt	Err	bitreich.org	70
1diff --git a/filters/nudge.filter b/filters/nudge.filter	/scm/tgtimes/file/filters/nudge.filter.gph	bitreich.org	70
i@@ -0,0 +1,28 @@	Err	bitreich.org	70
i+#!/usr/bin/env -S awk -f	Err	bitreich.org	70
i+#	Err	bitreich.org	70
i+# Insert blank lines between sections to avoid ugly orphans in PDF	Err	bitreich.org	70
i+# output.	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+BEGIN {	Err	bitreich.org	70
i+    LINES_PER_PAGE=73 # Determined by observation.	Err	bitreich.org	70
i+    MAX_SPACING=5 # Max empty we wish to allow at bottom of page.	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+    line=0	Err	bitreich.org	70
i+    incontent=1	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+	Err	bitreich.org	70
i+/./ {	Err	bitreich.org	70
i+    if (incontent == 0) {	Err	bitreich.org	70
i+           spaces=LINES_PER_PAGE - line % LINES_PER_PAGE + 1;	Err	bitreich.org	70
i+           if (spaces < MAX_SPACING) {	Err	bitreich.org	70
i+                  for (i = 0; i < spaces; i++) {	Err	bitreich.org	70
i+                      print "";	Err	bitreich.org	70
i+                      line++;	Err	bitreich.org	70
i+                  }	Err	bitreich.org	70
i+              }	Err	bitreich.org	70
i+           incontent = 1;	Err	bitreich.org	70
i+    }	Err	bitreich.org	70
i+}	Err	bitreich.org	70
i+/^$/ { incontent = 0; }	Err	bitreich.org	70
i+{ print $0; line++; }	Err	bitreich.org	70
i+	Err	bitreich.org	70
.
Response: text/plain
Original URLgopher://bitreich.org/0/scm/tgtimes/commit/1002873261d289...
Content-Typetext/plain; charset=utf-8