nudge.filter - tgtimes - The Gopher Times
(HTM) git clone git://bitreich.org/tgtimes git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/tgtimes
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
---
nudge.filter (532B)
---
1 #!/bin/sh
2 #
3 # Insert blank lines between sections to avoid ugly orphans in PDF
4 # output.
5
6 awk '
7 BEGIN {
8 LINES_PER_PAGE=73 # Determined by observation.
9 MAX_SPACING=5 # Max empty we wish to allow at bottom of page.
10
11 line=0
12 incontent=1
13 }
14
15 /./ && incontent == 0 {
16 spaces=LINES_PER_PAGE - line % LINES_PER_PAGE + 1;
17 if (spaces < MAX_SPACING) {
18 for (i = 0; i < spaces; i++) {
19 print "";
20 line++;
21 }
22 }
23 incontent = 1;
24 }
25 /`----/ { incontent = 0; }
26 { print $0; line++; }'
27