3 #############################################################################
4 # Function : CreateValidSGMLID
5 # Description : Creates a valid SGML 'id' from the given string.
6 # NOTE: SGML ids are case-insensitive, so we have a few special
7 # cases to avoid clashes of ids.
8 # Arguments : $id - the string to be converted into a valid SGML id.
9 #############################################################################
11 sub CreateValidSGMLID
{
14 # Append -CAPS to all all-caps identifiers
16 # Special case, '_' would end up as '' so we use 'gettext-macro' instead.
17 if ($id eq "_") { return "gettext-macro"; }
19 if ($id !~ /[a-z]/) { $id .= "-CAPS" };
32 <table cellspacing="0" cellpadding="2">
33 <tr><th align="left">Module</th><th style="padding-left: 0.5em; padding-right: 0.5em" colspan="4">Documented</th></tr>
41 my @undocumented_symbols;
43 my $module_name = shift @ARGV;
44 my $file = shift @ARGV;
45 my $indexfile = shift @ARGV;
47 open DOCUMENTED
, "<$file" or die "Cannot open $file: $!\n";
49 while (<DOCUMENTED
>) {
50 if (/(\d+)% (function|symbol) docs coverage/) {
52 } elsif (/(\d+) (function|symbol)s documented/) {
54 } elsif (/(\d+) not documented/) {
56 } elsif (/^\s*(\w+)\s*$/) {
57 push @undocumented_symbols, $1;
63 my $complete = defined $percentage && defined $documented && defined $undocumented;
65 die "Cannot parse documentation status file $file\n";
68 my $total = $documented + $undocumented;
71 ($directory = $indexfile) =~ s@
/[^/]*$@@
;
73 $bgcolor = ($row % 2 == 0) ?
"#f7ebd3" : "#fffcf4";
76 <tr bgcolor="$bgcolor">
77 <td><a href="$indexfile">$module_name</a></td>
78 <td align="right" style="padding-left: 0.5em">$documented</td>
79 <td>/</td><td>$total</td>
80 <td style="padding-right: 0.5em">($percentage%)</td>
82 if ($undocumented != 0) {
84 <td><a href="$directory/undocumented.html"><small>[missing]<small></a></td>
92 # Print an index of undocumented symbols for this module
95 @undocumented_symbols = sort { uc($a) cmp uc($b) } @undocumented_symbols;
97 my $base = "$BASEDIR/$directory";
99 open INDEX_SGML
, "<$base/index.sgml" or die "Cannot open $base/index.sgml: $!\n";
103 while (<INDEX_SGML
>) {
104 if (/<ANCHOR\s+id="([^"]+)"\s+href="([^"]+)">/) {
105 $index_symbols{$1} = $2;
111 open UNDOC_OUT
, ">$base/undocumented.html" or die "Cannot open $base/undocumented.html: $!\n";
112 print UNDOC_OUT
<<EOT;
115 <title>Undocumented functions in $module_name</title>
117 <body bgcolor="#ffffff">
122 for $symbol (@undocumented_symbols) {
123 my $id = CreateValidSGMLID
($symbol);
126 if (exists $index_symbols{$id}) {
129 ($href = $index_symbols{$id}) =~ s@
.*/(.*)$@
$1@
;
131 $output = qq(<a href
="$href">$symbol</a
>);
133 $output = qq($symbol);
135 print UNDOC_OUT
" <td>$output</td>\n";
137 print UNDOC_OUT
" </tr><tr>\n";
143 print UNDOC_OUT
<<EOT;