www: Prefer <name>.<section> pages over <name>
This commit is contained in:
parent
7302a6408a
commit
f5b35efdc3
1 changed files with 10 additions and 6 deletions
16
www/index.pl
16
www/index.pl
|
|
@ -181,13 +181,17 @@ sub man_pref {
|
|||
sub man_pref_name {
|
||||
my($name, $where) = @_;
|
||||
|
||||
my $man = man_pref undef, sql_and $where, sql 'm.name =', \$name;
|
||||
return ($man, '') if length $man->{name};
|
||||
# Check the <name>.<section> format first, because ~most~ cases where
|
||||
# there's a collision in the format, the <name>-only page is either
|
||||
# uninteresting or a file name parsing error.
|
||||
if ($name =~ /^(.+)\.([^.]+)$/) {
|
||||
my($n, $s) = ($1,$2);
|
||||
my $man = man_pref $s, sql_and $where, sql 'm.name =', \$n;
|
||||
return ($man, $s) if length $man->{name};
|
||||
}
|
||||
|
||||
return (undef, '') if $name !~ s/\.([^.]+)$// || !length $name;
|
||||
my $section = $1;
|
||||
$man = man_pref $section, sql_and $where, sql 'm.name =', \$name;
|
||||
length $man->{name} ? ($man, $section) : (undef, '');
|
||||
my $man = man_pref undef, sql_and $where, sql 'm.name =', \$name;
|
||||
length $man->{name} ? ($man, '') : (undef, '');
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue