-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 A few days ago, I decided it's finally time to learn what all that hype about AJAX is about. What would be a better guinea pig than trying to implement a seach box in our docs??? Well -- it turned out incredibly easy. Here it is: http://kainhofer.com/~lilypond/ajax/Documentation/user/lilypond-learning/index.html (or any other manual there, like the NR or so)
As soon as you have typed in three letters or more, a request is sent to the server to search a pre-generated index file (created by our texi2html init file) for the entered string. Currently, I'm building the search index from each manual's texinfo index and the search simply searches substrings of the index entries' titles. The other issue is that currently the search index is stored as a pure text file and each request has to go through that file line by line and match the search text... If JavaScript is disabled (so that AJAX won't work, either) or the files are viewed as static files on your harddisk (i.e. not over http, so the AJAX call would fail for sure), no search box is shown. What is missing in the texi2html init file is a check whether a manual really has an index. if it doesn't, the search box javascript should not be added to the html file at all. The other problem is that the www-post script doesn't seem to install the *.de.idx, *.ja.idx, *.fr.idx and *.es.idx files, while the *.en.idx files are properly installed to Documentation/user/... So for now the search only works in the English docs. (Obviously, I'm also missing an error check for the case where the index file can't be opened...) I have tested the search box in Konqueror, Firefox and Opera. Since I don't have an IE, of course I also couldn't test it... These search boxes are for now meant as a proof-of-concept implementation mainly. I haven't done any work on the corresponding CSS styling to make the results look nicer. If you are interested in the code, here's the patch for review: http://codereview.appspot.com/24076 It is also in git in my dev/kainhofer branch. Cheers, Reinhold - -- - ------------------------------------------------------------------ Reinhold Kainhofer, [email protected], http://reinhold.kainhofer.com/ * Financial & Actuarial Math., Vienna Univ. of Technology, Austria * http://www.fam.tuwien.ac.at/, DVR: 0005886 * LilyPond, Music typesetting, http://www.lilypond.org -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iD8DBQFJsV1MTqjEwhXvPN0RAt7bAKDR1PNrtYNgiwEy5IvC0u57wADNhACg2pF1 LGRr3FJnjI/lqz66czBGU8k= =HFvd -----END PGP SIGNATURE----- _______________________________________________ lilypond-devel mailing list [email protected] http://lists.gnu.org/mailman/listinfo/lilypond-devel
