The encoding metadata will be very useful in finding badly decoded man
pages. The package 'arch' is necessary to properly identify which
package was used, which is not obvious now that I'm going to switch more
systems to the (more common) x86_64 arch.
This removes the navigation menu on the right, leaving more space for
the actual contents. Instead, there are now a few links/tabs at the top
of the page. There's also a 'permalink' now.
The previous navigation combined the selection of man page versions,
translations and sections in a single menu. While handy in some cases,
in most cases it was just slow and messy. It also didn't scale very
well, some man pages have so many versions that it significantly
affected the page load time.
The 'locations' table has now also been moved into tab and is loaded
asynchronously as well, for the same performance reasons.
I had hoped that this new navigation would be much easier and more
convenient, but honestly, it's still a mess. At least the new code is
more maintainable, so perhaps I'll be able to make some incremental
improvements in the future.
I didn't do that before in order to ensure that the planner could always
optimize the LIKE queries, but it's optimizing them just fine with
placeholders now.
Man selection has to be performed over several thousand rows in some
cases. Loading all those in Perl and then doing the selection isn't very
efficient[1]. The getman() implementation was also buggy: The comparison
function used to determine which man page should be preferred was not
associative[2], and the result thus depended on the order in which the
man pages were compared. This resulted in some wrong selections in some
cases.
While I was at it, I also made the selection more strict:
- /man/unknown-hash would previously ignore the hash and just select
whatever man page. Now it results in a 404.
- Same with /man.unknown-section
- /man.section/hash is now disallowed, it's either /man.section or
/man/hash.
1) Note that all possible man pages are currently still loaded into Perl
anyway, because the ugly navigation menu on the right needs them. I plan
to revamp that entire menu to be more efficient and usable.
2) Initially I wrote the SQL implementation in a similar fashion to the
Perl implementation, and ended up with the same bug. I wasted more than
a day before I finally got to the current CTE query.
And improve man page lookup on "/man.section". If "man.section" itself
is a man page, then we display that. If it's not, we look for a man page
named "man" in section "section". (And if that section isn't available
we just show whatever the preferred version is for "man").
This fixes some occasional 404 links from the search results.
This splits the 'package' table into 'packages' and 'package_versions',
which should improve performance in some cases and simplify some future
queries.
Previously it wasn't very well defined whether packages were uniquely
identified by (system, name) or by (system, category, name). This is now
normalized to the latter form. This required changes to the package URLs
to include the category.