"; $need_p = 0; } printf FP "%s \n", $d, $d; $c = $d; } } # index by the first character of each keyword $c = ' '; for $n ( 0 .. $#minor ) { $d = substr( $minor[$n], 0, 1 ); if ( $d ne $c ) { printf FP "
"; $need_p = 0; } printf FP "%s \n", $minor[$n], $minor[$n] . $mark; } } my $str = <<'EOF'
To list of settings by category EOF . ( defined $opt_a && defined $opt_m ? "
Support for all settings suffixed with '*' was disabled at compile time.\n" : "" ) . <<'EOF' EOF ; print FP $str; close(FP); } # This uses the associative array $cats{} to store HREF values pointing into # the cattoc file. # # We could generate this file in alphabetic order as well, but choose to use # the order of entries in lynx.cfg, since some people expect that arrangement. sub gen_body { my @input = @_; my ( $n, $c ); my @h2; my $output = "body.html"; open( FP, ">$output" ) || do { print STDERR "Can't open $output: $!\n"; return; }; print FP <<'EOF';
\n", $url, $url; $needp = 1; } elsif ( $c =~ /^\.nf/ ) { $needp = 0; printf FP "
\n"; $nf = $count; } elsif ( $c =~ /^\.fi/ ) { printf FP "\n"; $nf = 0; $needp = 1; } elsif ( $c =~ /^$/ ) { if ( $m > 1 ) { my $j; for $j ( 1 .. $#h2 ) { close(FP); ++$curfilename; push @optnames, $h2[$j]; open( FP, ">$tmpdir/$curfilename" ) || do { print STDERR "Can't open tmpfile: $!\n"; return; }; $optname_to_fname{ $h2[$j] } = $curfilename; printf FP "
Please see the description of " . "%s\n", $h2[0], $h2[0]; $needp = 0; } @h2 = ""; } $m = 0; $first = 1; } elsif ( $c =~ /^[#[:alpha:]]/ && $m != 0 ) { if ($first) { close(FP); ++$curfilename; push @optnames, $h2[0]; open( FP, ">$tmpdir/$curfilename" ) || do { print STDERR "Can't open tmpfile: $!\n"; return; }; $optname_to_fname{ $h2[0] } = $curfilename; if ($any) { printf FP "
" : "
";
$needp = 0;
printf FP "%s
\n", $c;
$ex--;
}
elsif ($k) {
if ( $d != $n && !$nf ) {
printf FP "
";
$needp = 0;
}
$c =~ s/:$/:none<\/em>/;
$c =~ s/:/<\/code>: \n";
$needp = 0;
}
$p = 0;
if ( $input[ $n + 1 ] =~ /^#\s*==/ ) {
$c = " " if $needp;
$needp = 0;
printf FP "%s\n", $c;
}
if ( $nf != 0 && $nf-- == 0 ) {
printf FP "\n";
}
}
}
close(FP);
# Here we collect files with description of needed lynx.cfg
# options in the proper (natural or sorted) order.
open( FP, ">>$output" ) || do {
print STDERR "Can't open $output: $!\n";
return;
};
{
my @ordered =
( defined $opt_s ? ( sort keys(%optname_to_fname) ) : @optnames );
printf FP " ";
if ( defined $opt_s ) {
print FP "Options are sorted by name.\n";
}
else {
print FP "Options are in the same order as lynx.cfg.\n";
}
foreach $l (@ordered) {
my $fnm = $tmpdir . $optname_to_fname{$l};
open( FP1, "<$fnm" ) || do {
print STDERR "Can't open $fnm: $!\n";
return;
};
my $avail = ok($l);
if ( defined $opt_a || $avail ) {
my @lines = Support for this setting was disabled at compile-time.
EOF
}
}
close(FP1);
}
foreach $l ( values(%optname_to_fname) ) {
unlink $l;
}
}
print FP <<'EOF';
EOF
close(FP);
}
sub gen_cattoc {
my @input = @_;
my @major;
my %descs;
my %index;
my ( $n, $m, $c, $d, $found, $h1, $nf, $ex, $count, $once );
my $output = "cattoc.html";
open( FP, ">$output" ) || do {
print STDERR "Can't open $output: $!\n";
return;
};
print FP <<'EOF';
These are the major categories of configuration settings in Lynx:
%s\n", $descs{ $major[$n] };
}
$c = $index{ $major[$n] };
if ( $c ne "" ) {
my @c = split( /\n/, $c );
@c = sort @c;
printf FP
" Here is a list of settings that belong to this category\n";
printf FP "
To list of settings by name
EOF
. (
defined $opt_a && defined $opt_m
? " Support for all settings suffixed with '*' was disabled at compile time."
: ""
)
. <<'EOF'
EOF
;
print FP $str;
close(FP);
return @cats;
}
/;
$c = "
" . $c . "
";
if ( !$nf ) {
$c .= "
";
}
printf FP "%s\n", $c;
$d = $n + 1;
}
else {
if ( $p && !$nf ) {
printf FP "
$c";
if ( !$nf ) {
$c .= "
";
}
$next++;
}
printf FP "
EOF
$m = -1;
$h1 = 0;
$nf = 0;
for $n ( 0 .. $#input ) {
my $count = $#input;
my $once = 1;
$c = $input[$n];
if ( $input[$n] =~ /^\.h1\s/ ) {
$h1 = 1;
$c =~ s/^.h1\s*//;
$m = $#major + 1;
$d = 0;
$found = 0;
while ( $d <= $#major && !$found ) {
if ( $major[$d] eq $c ) {
$m = $d;
$found = 1;
}
$d++;
}
if ( !$found ) {
$major[$m] = $c;
$descs{ $major[$m] } = "";
$index{ $major[$m] } = "";
}
next;
}
elsif ( $h1 != 0 ) {
if ( $c =~ /^\.(nf|ex)/ ) {
my $s = $c;
$s =~ s/^\.[[:lower:]]+\s//;
if ( $s =~ /^[[:digit:]]+$/ ) {
$count = $s;
$once = $s;
}
}
if ( $input[$n] =~ /^$/ ) {
$h1 = 0;
}
elsif ( $input[$n] =~ /^\.nf/ ) {
$descs{ $major[$m] } .= "
" . "\n";
$nf = $count;
}
elsif ( $input[$n] =~ /^\.fi/ ) {
$descs{ $major[$m] } .= "
" . "\n";
$nf = 0;
}
elsif ( $input[$n] =~ /^\.ex/ ) {
$ex = $once;
$descs{ $major[$m] } .=
"Example"
. ( $ex > 1 ? "s" : "" )
. ":
\n" . "\n";
}
elsif ( $input[$n] =~ /^\s*#/ ) {
$c = $input[$n];
$c =~ s/^\s*#\s*//;
$descs{ $major[$m] } .= $c . "\n";
}
}
if ( $m >= 0 && $input[$n] =~ /^\.h2\s/ ) {
$c = $input[$n];
$c =~ s/^.h2\s*//;
$index{ $major[$m] } .= $c . "\n"
if ( defined $opt_a || ok($c) );
$h1 = 0;
}
if ( $nf != 0 && $nf-- == 0 ) {
$descs{ $major[$m] } .= "\n";
}
}
@major = sort @major;
for $n ( 0 .. $#major ) {
$cats{ $major[$n] } = sprintf( "header%03d", $n );
printf FP "%s
\n", $cats{ $major[$n] },
$major[$n];
if ( $descs{ $major[$n] } !~ /^$/ ) {
printf FP "Description
\n\n";
for $m ( 0 .. $#c ) {
my $avail = ok( $c[$m] );
my $mark = ( !$avail && defined $opt_m ) ? "*" : "";
printf FP "
\n";
}
}
my $str = <<'EOF'