summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/mk_feature_tables.pl
blob: 824be729a0384dc0bc4b0fefc252307f13e78335 (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
72
73
74
75
76
77
# /usr/bin/perl

# doc/src/sgml/mk_feature_tables.pl

use strict;
use warnings;

my $yesno = $ARGV[0];

open my $pack, '<', $ARGV[1] or die;

my %feature_packages;

while (<$pack>)
{
	chomp;
	my ($fid, $pname) = split /\t/;
	if ($feature_packages{$fid})
	{
		$feature_packages{$fid} .= ", $pname";
	}
	else
	{
		$feature_packages{$fid} = $pname;
	}
}

close $pack;

open my $feat, '<', $ARGV[2] or die;

print "<tbody>\n";

while (<$feat>)
{
	chomp;
	my ($feature_id, $feature_name, $subfeature_id,
		$subfeature_name, $is_supported, $comments) = split /\t/;

	$is_supported eq $yesno || next;

	$feature_name =~ s/</&lt;/g;
	$feature_name =~ s/>/&gt;/g;
	$subfeature_name =~ s/</&lt;/g;
	$subfeature_name =~ s/>/&gt;/g;

	print " <row>\n";

	if ($subfeature_id)
	{
		print "  <entry>$feature_id-$subfeature_id</entry>\n";
	}
	else
	{
		print "  <entry>$feature_id</entry>\n";
	}
	print "  <entry>",
	  defined($feature_packages{$feature_id})
	  ? $feature_packages{$feature_id}
	  : "",
	  "</entry>\n";
	if ($subfeature_id)
	{
		print "  <entry>$subfeature_name</entry>\n";
	}
	else
	{
		print "  <entry>$feature_name</entry>\n";
	}
	print "  <entry>$comments</entry>\n";

	print " </row>\n";
}

print "</tbody>\n";

close $feat;