Re: announcing mdoc.su, short manual page URLs

2013-02-21 Thread Constantine A. Murenin

Paul Schenkeveld wrote:

On Tue, Feb 19, 2013 at 12:27:01AM -0800, Constantine A. Murenin wrote:

Dear freebsd-{chat,current,doc}@,

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/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 col!

One question: is the os version accessible comewhere, i.e. can I ask for
a manpage from a specific version of FreeBSD?


Not originally; this would be the first RfE. :-)

The problem is mostly UI design, consistency and the actual mappings.

How would you expect to specify a specific version of FreeBSD?

/f74/stat   ?
/f74/stat.2 ?
/f74/2/stat ? hmm

/f7/stat?
/f7/stat.2  ?
/f7/2/stat  ?  that wouldn't be for 7.2, right?

/FreeBSD-7.4/stat   ?
/FreeBSD-7.4/stat.2 ?
/FreeBSD-7.4/2/stat ? hmm...

/FreeBSD-7/stat ?
/FreeBSD-7/stat.2   ?
/FreeBSD-7/2/stat   ? -- again, an ambiguity

/FreeBSD/9/8/zfs ?  not so bad, since the recent RE schedule, until:
/FreeBSD/9/2/stat ? nope, won't do, either
/FreeBSD/9/zfs  ?  Wait, that'd be zfs(9), not zfs from "FreeBSD 9"!

So, it gets hairy rather quickly. :)

ATM, none of the above are supported.

Also, consider that this has to be mapped back to the options provided 
by man.cgi on FreeBSD.org, which only has "FreeBSD 9-current" as a 
single-digit-option, with all prior versions being two-number releases 
like "FreeBSD 4.8-RELEASE" (going back to "FreeBSD 1.0-RELEASE"), and a 
couple of "FreeBSD 9.1-stable" for only the latest release of the last 
couple of major versions, and going back to only "FreeBSD 6.4-stable" 
(which will probably soon itself be gone, too), so, I might have to 
maintain a separate mapping from "f4" to, say, "FreeBSD 4.11-RELEASE", 
and such fine-grained mappings is something I'd rather avoid, since the 
chain gets outdated fairly quickly.  Also, how would you distinguish 
between the latest "-RELEASE" and "-stable"?


Remember, this is a deterministic URL shortener, and I don't want it to 
become an "I'm Feeling Lucky"! :-)


I want to make sure to have some realistic mappings, for FreeBSD and 
NetBSD, before adding any such features.  OpenBSD, on the other hand, 
would be pretty easy, since every release is a two digit number, and 
DragonFly man-pages don't let you specify a release, so that's already 
supported. :-)


Adding support for two-digit releases with a scheme like "/f91/" and 
"/FreeBSD-9.1/" is something that's very doable, but do you want to have 
to specify "/f63/" instead of a simpler (though more ambiguous) "/f6/"? 
   What exactly is your usecase?  Mapping between "f91" or 
"(FreeBSD|freebsd)-9.1" and "FreeBSD 9.1-RELEASE", with "9" and "1" 
representing all possible FreeBSD releases (except for subreleases like 
5.2.1, or any releases before 4.0 in the abbreviated notation, e.g. to 
reserve "/f10/" for FreeBSD 10, instead of 1.0), should be very easy to 
add; would that be sufficient?


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



___
freebsd-chat@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-chat
To unsubscribe, send any mail to "freebsd-chat-unsubscr...@freebsd.org"


Re: announcing mdoc.su, short manual page URLs

2013-02-20 Thread Julian Djamil Fagir
Hi,

On Wed, 20 Feb 2013 16:44:14 +0100 Julian Djamil Fagir wrote:
> On Tue, 19 Feb 2013 00:27:01 -0800 Constantine A. Murenin wrote:
> > Questions, comments and suggestions are very welcome.  
> > Available through IPv4 and IPv6.  
> > Enjoy!
> 
> I used your plugin as an opportunity to finish a plugin for Dokuwiki I once
> wrote (but only for NetBSD):

sorry for the noise, but one correction: The initial plugin only worked for
NetBSD. manlink works for FreeBSD, DragonFlyBSD and OpenBSD as well.

Regards, Julian


signature.asc
Description: PGP signature


Re: announcing mdoc.su, short manual page URLs

2013-02-20 Thread Julian Djamil Fagir
Hi,

On Tue, 19 Feb 2013 00:27:01 -0800 Constantine A. Murenin wrote:
> Questions, comments and suggestions are very welcome.  
> Available through IPv4 and IPv6.  
> Enjoy!

I used your plugin as an opportunity to finish a plugin for Dokuwiki I once
wrote (but only for NetBSD):
https://www.dokuwiki.org/plugin:manlink
It automatically exchanges manpage references like ftpd(8) by the appropriate
links, using mdoc.su.

If you don't want the traffic (though I doubt anybody will use it), please
tell me, and I'll try to directly link the manpage sites.

Regards, Julian


signature.asc
Description: PGP signature


Re: announcing mdoc.su, short manual page URLs

2013-02-20 Thread Paul Schenkeveld
On Tue, Feb 19, 2013 at 12:27:01AM -0800, Constantine A. Murenin wrote:
> Dear freebsd-{chat,current,doc}@,
> 
> 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/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 col!

One question: is the os version accessible comewhere, i.e. can I ask for
a manpage from a specific version of FreeBSD?

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
___
freebsd-chat@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-chat
To unsubscribe, send any mail to "freebsd-chat-unsubscr...@freebsd.org"


Re: announcing mdoc.su, short manual page URLs

2013-02-19 Thread Darren Pilgrim
One of the really cool things Constantine didn't mention is the entire 
site is just the nginx config!  It's done with what some might consider 
slight abuses of rewrite rules, but it does mean the whole thing is 
completely memory resident.  The full config on github is definitely 
worth a read.

___
freebsd-chat@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-chat
To unsubscribe, send any mail to "freebsd-chat-unsubscr...@freebsd.org"


Re: announcing mdoc.su, short manual page URLs

2013-02-19 Thread Dag-Erling Smørgrav
"Constantine A. Murenin"  writes:
> I would like to announce and introduce http://mdoc.su/>, a
> deterministic URL shortener for BSD manual pages, written entirely in
> nginx.conf.  [...]

This looks awesome, thank you very much!

DES
-- 
Dag-Erling Smørgrav - d...@des.no
___
freebsd-chat@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-chat
To unsubscribe, send any mail to "freebsd-chat-unsubscr...@freebsd.org"

announcing mdoc.su, short manual page URLs

2013-02-19 Thread Constantine A. Murenin

Dear freebsd-{chat,current,doc}@,

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/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.

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 controls FreeBSD rewriting:

location /FreeBSD { rewrite ^/FreeBSD(/.*)?$/f$1;   }
location /f {
set $fb "http://www.freebsd.org/cgi/man.cgi?query=";;
set $fs "&sektion=";
rewrite ^/freebsd(/.*)?$/.$1;
rewrite ^/./([^/.]+)/([^/]+)$   $fb$2$fs$1  
redirect;
rewrite ^/./([^/]+)\.([1-9])$   $fb$1$fs$2  
redirect;
rewrite ^/./([^/]+)$$fb$1$fs
redirect;
rewrite ^/./?$  /   last;
return  404;
}

Translation: "/FreeBSD" and "/freebsd" get rewritten to "/f" internally, 
without any extra replies 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/f/ redirect to the main "/" page internally, 
without affecting the URL that's visible to the user, making it easier 
to keep a starting page specifically for one BSD.


Questions, comments and suggestions are very welcome.  
Available through IPv4 and IPv6.  
Enjoy!


Best regards,
Constantine.
___
freebsd-chat@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-chat
To unsubscribe, send any mail to "freebsd-chat-unsubscr...@freebsd.org"