Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by mattlewis (admin) Jan 18, 2012
- 2223 views
A few years ago I was in hog heaven. If I needed help regarding a Euphoria word, all I had to was hit one key and and a specific article describing the function of the word popped up in a browser window, almost before my finger left the key.
That was then, this is now. Where is Juergen Luethje when you need him? Juergen posted a really nifty little program which indexed Euphoria 3.* documentation so that a search word could be used to locate a specific article regarding the subject from the help documentation.
I do believe the current HTML documentation is a bit more complex, but a specific article can be accessed directly, provided you have:
...
I am rue to do all the data entry, if someone else is working on a better system, or has a better approach in mind.
In its offline format, the documentation contains a javascript based search function. Take a look at the file, js/search.js. Most of this file is an index of the documentation. Right up near the top, you'll see something like:
var base=''; var index={ "allsorts.ex":[["allsorts","_369_allsortsex","Bundled Demos"]], "Disclaimer:":[["e2c","_645_disclaimer","Euphoria To C Translator"]], "declare an enumerated value":[["syntax","_274_declareanenumeratedvalue","Formal Syntax"]], "EXT_SIZE":[["std_filesys","_1501_ext_size","File System"]], "has_match":[["std_regex","_3297_has_match","Regular Expressions"]], "In-lining of Routine Calls":[["perform","_738_inliningofroutinecalls","Performance Tips"]], "Lock Type Constants":[["std_eds","_4137_locktypeconstants","Euphoria Database (EDS)"]], "NOTEMPTY":[["std_regex","_3189_notempty","Regular Expressions"]], "On / Off options":[["lang_toplevel","_182_onoffoptions","Special Top-Level Statements"]], "PAGE_READ_WRITE":[["std_memconst","_5905_page_read_write","Memory Constants"]], "PARENT":[["std_pipeio","_1895_parent","Pipe Input/Output"]], "regex":[["std_regex","_3251_regex","Regular Expressions"]], "sanity":[["sanity","_456_sanity","Bundled Demos"]], "Socket Type Constants":[["std_socket","_4913_sockettypeconstants","Core Sockets"]], "sound":[["std_win32_sounds","_6636_sound","Windows Sound"]],...and it goes on for quite a while. This is the index data in JSON format. It should be relatively easy to parse this to make it easy for euphoria to use. The first element in double quotes is the topic / keyword / whatever. For some words, there may be multiple entries, but each entry is easy to combine to get the link:
"sound":[["std_win32_sounds","_6636_sound","Windows Sound"]] becomes: std_win32_sounds.html#_6636_sound
Hmm....it might make sense for us to generate this as a euphoria include file that would do it for you. I'm sure we could come up with a more sophisticated search than we have in the javascript function, too.
Matt