Re: announcing mdoc.su, short manual page URLs

From: Constantine A. Murenin <cnst++_at_freebsd.org>
Date: Fri, 22 Feb 2013 01:28:05 -0800
On 2013-W08-3 15:37 +0100, Paul Schenkeveld wrote:
> On Tue, Feb 19, 2013 at 12:27:01AM -0800, Constantine A. Murenin wrote:
> > Dear freebsd-{chat,current,doc}_at_,
> >
> > I would like to announce and introduce <URL: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/f/zfs
> > http://mdoc.su/f/zfs.8
> > http://mdoc.su/f/8/zfs
> > http://mdoc.su/freebsd/zfs
> > http://mdoc.su/FreeBSD/zfs
> >
> > http://mdoc.su/d/hammer.5
> > http://mdoc.su/d/hammer.8
> >
> > etc.
>
> Very coooool!
>
> One question: is the os version accessible comewhere, i.e. can I ask for
> a manpage from a specific version of FreeBSD?

I have added OS version support today:

http://mdoc.su/f91/aibs.4
http://mdoc.su/FreeBSD-9.1/aibs.4
http://mdoc.su/FreeBSD-8.1/acpi_aiboost.4

<URL:http://mdoc.su/FreeBSD 8.2/aibs.4> :-)

OpenBSD and NetBSD versions are also supported 
(as mentioned, DragonFly doesn't provide versioned 
man-pages through web-man, so, it's always been 
supported).

Through the long notation, any possible release should be supported, 
including point releases like 5.2.1, 4.6.2, 4.1.1, 2.2.8 etc 
(subject to man.cgi support, of course), and long releases like 4.11.  
Through the short "/f" notation, only versions 
from 4.0 to a futuristic 19.9 are supported 
(except for point releases and versions like 4.10 and 4.11).

Still written completely in nginx.conf. :-)

The FreeBSD portion is now:

	location ^~ /FreeBSD {
		rewrite	"^/FreeBSD([ -/].*)?$"	/freebsd$1	last;
		return	404;
	}
	location ^~ /f {
		set	$fb	"http://www.freebsd.org/cgi/man.cgi?query=";
		set	$fs	"&sektion=";
		rewrite	^/f([4-9]|1[0-9])([0-9])(/.*)?$	/freebsd-$1.$2$3;
		rewrite	"^/freebsd[ -/](?<fp>[0-9]+(\.[0-9]+)+)(/.*)?$"	/.$3;
		if ($fp) {
			set	$fp	"&manpath=FreeBSD+$fp-RELEASE";
		}
		rewrite	^/freebsd(/.*)?$	/.$1;
		rewrite	^/./([^/.]+)/([^/]+)$		$fb$2$fs$1$fp	redirect;
		rewrite	^/./([^/]+)\.([1-9])$		$fb$1$fs$2$fp	redirect;
		rewrite	^/./([^/]+)$			$fb$1$fs$fp	redirect;
		rewrite	^/./?$	/	last;
		return	410;
	}

Enjoy!

Best regards,
Constantine.

>
> I have to disagree with Darren Pilgrim however, this is not "slight abuse"
> of rewrite rules but putting rewrite rules to "better use" :-)
>
> Kind regards,
>
> Paul Schenkeveld
Received on Fri Feb 22 2013 - 08:28:07 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:35 UTC