www: Fix versions page for multichar sections + add section selector
This commit is contained in:
parent
3bf860f54e
commit
ca07b78610
1 changed files with 18 additions and 1 deletions
19
www/index.pl
19
www/index.pl
|
|
@ -1133,7 +1133,7 @@ TUWF::get qr{/loc/([a-fA-F0-9]{40})}, sub {
|
|||
|
||||
|
||||
# /ver[.$shorthash][.$lang]/$name.$section
|
||||
TUWF::get qr{/ver(?:\.([a-fA-F0-9]{8}))?(?:\.([^/]+))?/([^/]+)\.([0-9a-zA-Z])}, sub {
|
||||
TUWF::get qr{/ver(?:\.([a-fA-F0-9]{8}))?(?:\.([^/]+))?/([^/]+)\.([0-9a-zA-Z]+)}, sub {
|
||||
my($shorthash, $lang, $name, $sect) = tuwf->captures(1,2,3,4);
|
||||
$shorthash = $shorthash ? shorthash_to_int $shorthash : -1;
|
||||
$lang ||= '';
|
||||
|
|
@ -1148,6 +1148,10 @@ TUWF::get qr{/ver(?:\.([a-fA-F0-9]{8}))?(?:\.([^/]+))?/([^/]+)\.([0-9a-zA-Z])},
|
|||
ORDER BY p.system DESC, p.name, v.released DESC, f.shorthash
|
||||
');
|
||||
|
||||
my @sect = map $_->{section}, tuwf->dbAlli(
|
||||
'SELECT DISTINCT section FROM mans WHERE name =', \$name, 'ORDER BY section'
|
||||
)->@*;
|
||||
|
||||
my $langs = man_languages $name, $sect;
|
||||
|
||||
my %sys;
|
||||
|
|
@ -1157,6 +1161,19 @@ TUWF::get qr{/ver(?:\.([a-fA-F0-9]{8}))?(?:\.([^/]+))?/([^/]+)\.([0-9a-zA-Z])},
|
|||
framework_ title => $title, mainclass => 'verpage', sub {
|
||||
h1_ $title;
|
||||
|
||||
p_ sub {
|
||||
txt_ 'Alternative sections: ';
|
||||
for (0..$#sect) {
|
||||
txt_ ', ' if $_ > 0;
|
||||
if(($sect[$_]||'') eq $sect) {
|
||||
b_ $sect[$_];
|
||||
} else {
|
||||
a_ href => '/ver'.($lang?".$lang":'')."/$name.$sect[$_]", $sect[$_];
|
||||
}
|
||||
}
|
||||
txt_ '.';
|
||||
} if @sect > 1;
|
||||
|
||||
p_ sub {
|
||||
txt_ 'Available languages: ';
|
||||
for (0..$#{$langs}) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue