[Vim-l] Template:Help - Alternatives
John Beckett
johnb.beckett at gmail.com
Sun Jun 24 06:27:54 UTC 2007
The current Template:Help procedure uses a CGI python script
called 'help'. I know very little about CGI, but it seems to me
that the script will put an enormous stress on the sourceforge
server.
I don't know how to view the script currently used, but I found
what appears to be the code in a post from bastl (who has been
very busy).
This is the current process:
Client sends:
GET http://vimplugin.sourceforge.net/cgi-bin/help?tag=word
That invokes the server script to lookup "word". The script
reads 7900 lines (250KB) from the Vim tags file, splits each
line, and inserts the fields into an associative array.
Then the array is used to lookup the required tag. I think it
does that, with no caching, for each Help link.
The script then sends a redirect telling the client to go to:
http://vimdoc.sf.net/htmldoc/motion.html#word
(It should be "sourceforge", not "sf", as I have mentioned
in another message. Using "sf.net" fails because it causes a
redirect which makes the client forget the "#word" anchor.)
So, the script simply calculates the page "motion.html" by a
lookup using the tag "word".
The advantage of this approach is that it will continue to work
even if the Vim Help is re-arranged. Also, someone editing a
wiki page doesn't have to manually determine the URL.
But surely there is some "nicer" way to achieve what we want
(nicer than forcing the sourceforge server to do all that work
for each lookup)?
I'm wondering if we could have some procedure which makes the
help link static (go directly to "motion.html#word", with no CGI
query). Periodically, a bot could visit all wiki pages and
update the help links.
BTW I suspect that it would be more efficient to have the CGI
script simply enumerate the tags file, and manually check each
line to see if it contains the tag. There is no need to build an
associative array for every entry in the tags file.
I should mention that the script was created by bastl while the
rest of us were still debating which wiki site to use. If I had
the job of starting the wiki, it would not have arrived until
late 2008. So my suggestions that the script is less than
perfect should not be regarded as any kind of criticism.
Any comments?
John
More information about the Vim-l
mailing list