NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
announcing mdoc.su, a deterministic man-page URL shortener
Dear NetBSD,
I would like to announce and introduce http://mdoc.su/ ,
a deterministic URL shortener for BSD manual pages,
written entirely in nginx.conf.
It supports several address schemes, for example:
http://mdoc.su/NetBSD/3X11/XFree
http://mdoc.su/netbsd/macppc/4/intro
http://mdoc.su/n/intro.4.macppc
http://mdoc.su/n/mdoc.7
http://mdoc.su/n/curl
Source code for the whole mdoc.su.nginx.conf is available at:
https://github.com/cnst/mdoc.su
https://bitbucket.org/cnst/mdoc.su
Specifically, the following currently (as of 2013-02-17) controls
NetBSD rewriting, and best describes the access scheme for NetBSD:
location /NetBSD { rewrite ^/NetBSD(/.*)?$ /n$1; }
location /n {
set $nb "http://netbsd.gw.com/cgi-bin/man-cgi?";
rewrite ^/netbsd(/.*)?$ /.$1;
rewrite ^/./([a-z]+[0-9]*[kx]?)/([^/]+)/([^/]+)$ $nb$3+$2.$1 redirect;
rewrite ^/./([^/]+)/([^/]+)$ $nb$2+$1 redirect;
rewrite ^/./([^/]+)\.([1-9]\.[a-z]+[0-9]*[kx]?)$ $nb$1+$2 redirect;
rewrite ^/./([^/]+)\.([1-9])$ $nb$1+$2 redirect;
rewrite ^/./([^/]+)$ $nb$1 redirect;
rewrite ^/./?$ / last;
return 404;
}
Basically, "/NetBSD" and "/netbsd" are rewritten to "/n" internally
(with no extra reply to the user), and then the rest of the URI is
analysed, and a "302 Found" redirect is finally issued to the user.
Pages like http://mdoc.su/n/ redirect to the main "/" page internally,
without affecting the URL that's visible to the user, making it easier
to keep as a starting page specifically for one BSD.
Comments and suggestions are very welcome. I've noticed there is an
inconsistency between the available sections on these man-cgi scripts
and the actual data that they can access: for example, only "X11R6"
is listed on NetBSD's man-cgi, not "3X11", and, likewise, 3p is missing
from OpenBSD's man.cgi, although http://mdoc.su/o/sort.3p works great.
It would be nice if people more familiar with the organisation of
manual pages would provide some insights on restricting or relaxing the
current rewrites to be more conforming.
Also, is there a preferred method of referring to a certain page through a URL?
What looks better: mdoc.su/n/8/envstat or mdoc.su/n/envstat.8 ?
Although the "/8/sysctl" style seems to be more popular with various
static man-page collections and web-sites, and is potentially more flexible,
especially for NetBSD, I nonetheless think that for the simple [1-9] sections
the "/sysctl.8" style looks better and more familiar.
P.S. Mail-Followup-To: NetBSD-Docs%NetBSD.org@localhost.
Best regards,
Constantine.
Home |
Main Index |
Thread Index |
Old Index