File: make_html_index

package info (click to toggle)
gri 2.12.26-1
  • links: PTS
  • area: main
  • in suites: buster, sid
  • size: 5,952 kB
  • ctags: 2,396
  • sloc: cpp: 36,598; sh: 4,196; lisp: 3,764; perl: 1,362; ansic: 1,046; makefile: 606
file content (42 lines) | stat: -rwxr-xr-x 1,122 bytes parent folder | download | duplicates (6)
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
#!/usr/local/bin/perl
# Create HTML index from index of pre-installed info page.
# Bug: the @code{} items get lost, too bad.
$debug = 0; # change to 1 to get some debugging output
open(IN, "info -f ./gri.info 'Concept Index' | ") 
    ||  die "Cannot get 'Concept Index'\n";

print "
\@c HTML <!-- newfile ConceptIndex.html \"Gri: Concept Index\" \"Concept Index\" -->
\@c HTML <h1>Concept index</h1>
\@node   Concept Index, Index of Builtins, Index of Builtins, Top

\@c HTML <b>Navigation</b>:
\@c HTML <a href=\"#CommandIndex\">next</a>,
\@c HTML <a href=\"#License\">previous</a>,
\@c HTML <a href=\"#Top\">parent</a>.

\@itemize \@bullet
";

# Skip header ... this may be brittle, since how do we know how it's defined?
while(<IN>) {
	chop;
	#print "SKIPPING ($_)\n";
	last if /Menu:/;
}

# Process the body.
while(<IN>) {
	chop;
	print "BEFORE [$_]\n" if $debug;
	s/\s*\((line)\s*[0-9]+\)\s*//;
	s/\s*$//;
	print "AFTER  [$_]\n" if $debug;
	next if /^$/; # ignores "(line #)" lines, which occur for long items.
	s/\* //;
	s/\.$//;
	s/:\s*/\n ... \@xref{/;
	s/$/}/;
	print "\@item\n $_\n";
}
print "\@end itemize\n";