Some fixes and repo updates

This commit is contained in:
Yorhel 2023-11-26 10:33:30 +01:00
parent 580fa89520
commit c2a1dd6416
5 changed files with 29 additions and 8 deletions

View file

@ -763,7 +763,7 @@ sub man_nav_ {
ul_ sub {
for (0..$#$toc) {
li_ sub {
a_ @$htmllang, href => sprintf('#head%d', $_+1), lc $toc->[$_];
a_ @$htmllang, href => sprintf('#head%d', $_+1), sub { lit_ lc $toc->[$_] };
}
}
}
@ -818,7 +818,7 @@ sub man_page {
}
my @toc;
$fmt =~ s{\n<b>(.+?)<\/b>\n}{
$fmt =~ s{\n<b>([^<\n]+?)<\/b>\n}{
push @toc, $1;
my $c = @toc;
qq{\n<a href="#head$c" id="head$c">$1</a>\n}
@ -1079,11 +1079,11 @@ TUWF::get qr{/lang/([^/]+)/([^/]+)} => sub { tuwf->resRedirect('/man.'.tuwf->cap
TUWF::get '/json/tree.json' => sub {
my $f = tuwf->validate(get =>
name => { required => 0, maxlength => 256 },
section => { required => 0, maxlength => 32 },
locale => { required => 0, maxlength => 32 },
cur => { required => 0, default => '', regex => qr/^[a-fA-F0-9]{40}$/ },
hash => { required => 0, default => '', regex => qr/^[a-fA-F0-9]{40}$/ },
name => { default => '', maxlength => 256 },
section => { default => '', maxlength => 32 },
locale => { default => sub{$_[0]}, maxlength => 32 },
cur => { default => '', regex => qr/^[a-fA-F0-9]{40}$/ },
hash => { default => '', regex => qr/^[a-fA-F0-9]{40}$/ },
)->data;
return tuwf->resNotFound() if !$f->{hash} && !($f->{section} && $f->{name});