blob: 410c3baa10fcd5c85d16d2f77ad79641159be427 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
#! /usr/bin/perl -w
# $Cambridge: exim/doc/doc-scripts/DoConts,v 1.1 2004/10/07 15:04:35 ph10 Exp $
$style = (@ARGV > 0)? $ARGV[0] : "a4ps";
open(IN, "z-rawindex") || die "Can't open z-rawindex\n";
open(OUT, ">z-contents") || die "Can't open z-contents\n";
print OUT <<'EOF';
.if ~~sys.fancy
.linelength ~~sys.linelength + 0.2in
.pagedepth ~~sys.pagedepth - 0.2in
.linedepth 12.24
.fi
.include "markup.sg"
.set chapter -1
.set p 0
.format p roman
.tabset 2em 2em
.
.foot
.set p ~~sys.pagenumber
$c [~~p]
.endfoot
.
.chapter Contents
.disable filling
.justify left
EOF
while(<IN>)
{
if (/\$e/)
{
s/\$e\s*$//; # "see also" lines have no line number
s/--\s*\d+$//; # remove "extra" number for index page
s/\n$//; # trailing newline
if (!/^\$/)
{
print OUT ".blank\n";
print OUT ".if ~~sys.leftonpage < 2*~~sys.linedepth\n";
print OUT ".newpage\n";
print OUT ".fi\n";
print OUT "\$shead\{$_\}\n";
print OUT ".blank\n";
}
else
{
print OUT "$_\n";
}
}
}
close(IN);
close(OUT);
system("sgcal z-contents -to zc-gcode -style $style -index /dev/null");
if ($style eq "a4ps")
{
system("sgtops zc-gcode -to zc-ps");
print "PostScript in zc-ps\n";
}
else
{
system("mv -f zc-gcode zc-txt");
print "Text in zc-txt\n";
}
# End
|