1. Indexing Euphoria HTML Documentation for context sensitive help
- Posted by K_D_R Jan 18, 2012
- 2229 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:
1) specific keyword - "db_open", or "append"
2) Numeric Index for the keyword you want information about
3) The name of the section containing the article referenced by index number and keyword
-- sequence hlp ={ {"append", "std_sequence", "2551"}, {"db_create", "std_eds", "4101"}, {"db_open", "std_eds", "4108"}, include std/console.e constant W = 1, -- word S = 2, -- section N = 3 -- number sequence hlp ={ {"append", "std_sequence", "2551"}, {"db_create", "std_eds", "4101"}, {"db_open", "std_eds", "4108"} } -- accesses specific article regarding "db_create" from local documentation: system_exec( "epiphany file:///home/kenneth/euphoria.4.0.3/docs/html/" & hlp[2][S] & ".html#_" & hlp[2][N] & "_" & hlp[2][W])
The programming to match the search word from the editor and pass the related HTML documentation section name and index number shouldn't be difficult.
The problem is building the sequence data base, but within 5 minutes I had a program up and running which created a EuHelp.edb and allowed me to start packing in the relevant data. Yes, friends and neighbors, I'm that good.
This is a copy of the edit screen listing my trial run at data entry:
Euphoria Keyword Database (a)dd, (d)elete, (f)ind, (l)ist, (p)rint, (q)uit: l 2551 append std_sequence 4011 eds std_eds 4082 db_dump std_eds 4108 db_open std_eds (a)dd, (d)elete, (f)ind, (l)ist, (p)rint, (q)uit:
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.
All comments and suggestions will be deeply appreciated.
Regards, Kenneth Rhodes
2. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by mattlewis (admin) Jan 18, 2012
- 2225 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
3. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by useless_ Jan 19, 2012
- 2164 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. <snip>
A few years ago all i had to do was ask Tiggr. She not only had the help files indexed, but all contributions in the RDS archives were indexed too. Tiggr built the index file. I could pop up the help file and instances of how people used the word. I could pop up what apps used any certain include file. Etc..
It's one of the many things i deleted from Tiggr when i was laughed at for having wasted my time on such a thing. This was back when RDS wouldn't have enough space to put it on the http pages, so i set it up on irc.
How much time will you waste to set up something half as encompassing as i did?
useless
4. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by jimcbrown (admin) Jan 19, 2012
- 2196 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. <snip>
A few years ago all i had to do was ask Tiggr. She not only had the help files indexed, but all contributions in the RDS archives were indexed too. Tiggr built the index file. I could pop up the help file and instances of how people used the word. I could pop up what apps used any certain include file. Etc..
I was there, in 2008. I was impressed that you managed to come up with a working system from nothing in a day or two.
It's one of the many things i deleted from Tiggr when i was laughed at for having wasted my time on such a thing.
I don't recall anyone laughing. I do recall leaving my computer for 5 minutes (I had to pee!) and then coming back and seeing you had asked and then decided to delete everything while I was gone.
This was back when RDS wouldn't have enough space to put it on the http pages, so i set it up on irc.
How much time will you waste to set up something half as encompassing as i did?
eukat
There are technical difficulties with using IRC bots exclusively for that functionality (such as the difficulties of putting a web page on the web to search or allowing others to do off-line searches), which leaves the door open for other approaches to spring up and co-exist side-by-side.
5. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by K_D_R Jan 20, 2012
- 2105 views
"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
Thanks Matt!
An include file in the format would be the cat's meow:
sequence euhelp = { {"sound"}, {"std_win32_sounds.html#_6636_sound"}, {"db_create"}, {"std_eds.html#_4101_db_create"}, {"db_open"}, {"std_eds.html#_4108_db_open"} }
Your assistance is much appreciated! Regards, Ken
Regards, Kenneth Rhodes
6. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by useless_ Jan 20, 2012
- 2109 views
I was there, in 2008. I was impressed that you managed to come up with a working system from nothing in a day or two.
Thanks. I used hackserv by bjackson, which used code by jconsuegra and gharris, and DCuny's win32lib v0.42, all glued to the backside of mirc to be the irc presence. I wish i could remember who helped with the php code later.
There are technical difficulties with using IRC bots exclusively for that functionality (such as the difficulties of putting a web page on the web to search or allowing others to do off-line searches), which leaves the door open for other approaches to spring up and co-exist side-by-side.
I had a system for Tiggr to respond to publicly available webpages via any browser. You contact the site with your search criteria, the site used php to contact Tiggr at my home, and she'd generate a reply and wrap it in html back to the php on the server, and the php on the commercially hosted site forwarded this to you transparently. This solves some major problems with irc when dealing with a lot of data, data needing formatting, or with pictures. Like asking her what an AT32UC3L064 is.
People complained bitterly about having the http link to the answer when the question was asked on irc. And they wouldn't ask Tiggr thru a browser interface as simple as a Google box in a browser window. No matter how much code i wrote, or data i made available, it was never acceptable. In the late 1990's, Tiggr even recieved and sent email, no one ever used it.
Good luck. I am truely wondering how you'll ever satisfy more than just yourself with this.
useless
Forked into: Search and Nostalgia
7. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by K_D_R Feb 23, 2012
- 2014 views
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.
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
Using an EDS database, "EuHelp.edb" with a table, "eu_kwds", a table with three fields, the first is the key, which is the search_word, a euphoria keyword, the second is the html documentation section, and the third is the html index #. Works like a charm:
k = db_find_key(search_word) if k > 0 then index = db_record_data(k) section = index[1] index = index[2] system_exec(BROWSER & "file:///home/kenneth/euphoria.4.0.3/docs/html/" & section & ".html#_" & index & "_" & search_word, 0) end if
That is all there is to it!
8. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by K_D_R Nov 07, 2012
- 1791 views
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.
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
Using an EDS database, "EuHelp.edb" with a table, "eu_kwds", a table with three fields, the first is the key, which is the search_word, a euphoria keyword, the second is the html documentation section, and the third is the html index #. Works like a charm:
k = db_find_key(search_word) if k > 0 then index = db_record_data(k) section = index[1] index = index[2] system_exec(BROWSER & "file:///home/kenneth/euphoria.4.0.3/docs/html/" & section & ".html#_" & index & "_" & search_word, 0) end if
That is all there is to it!
Well, I spent a lot of time manually entering the three data items necessary to call up the relevant article in a browser window - Now I find that the "index numbers" or (whatever it is called) has changed;
for Euphoria 4.0.5 --http://openeuphoria.org/docs/std_eds.html#_4203_db_open file:///home/kenneth/euphoria.4.0.3/docs/html/std_eds.html#_4108_db_open [Edited for format - Admin]
So... will the index numbers change with each new version of Euphoria?
Regards,
9. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by SDPringle Nov 07, 2012
- 1784 views
for Euphoria 4.0.5 --http://openeuphoria.org/docs/std_eds.html#_4203_db_open file:///home/kenneth/euphoria.4.0.3/docs/html/std_eds.html#_4108_db_open [Edited for format - Admin]
So... will the index numbers change with each new version of Euphoria?
Regards,
There is no reason to assume these index numbers will remain the same even between 4.0.5 and 4.0.6. I find the javascript engine quite handy. Perhaps you could make a JSON parser in EUPHORIA. Use a combination of the function find_replace from regex or the much better named match_replace and the function value.
Shawn Pringle
10. Re: Indexing Euphoria HTML Documentation for context sensitive help
- Posted by K_D_R Jan 26, 2013
- 1603 views
Well, I finally came up with the idea of searching the key_index.html file for search word "hits" and extracting the path to the related *.html file and -hopefully- the best specific article(s). Some command "key words" are re-used in different libraries, and some commands are referenced, or discussed in many different articles, so I use a "maxfile" integer setting to limit the number of *.html "articles" will be opened.
This is rough, even by my standards. Comments, suggestions for improvements will be welcomed.
-- -- EuHelp.e -- -- include this file just before the get_escape(boolean help) routine in ed.ex: include std/filesys.e include std/text.e include std/console.e include std/wildcard.e -- constant BROWSER = "midori --log-file=midori.log " -- constant BROWSER = "dillo " -- constant BROWSER = "google-chrome " constant BROWSER = "netsurf " constant EUDIR = getenv("EUDIR") constant ONLINE_INDEX_MATCHES_LOCAL = 0 -- FALSE -- set to 1, if you have verified that your -- local *.html index numbers match those online -- integer = 0 = offline, use local html files (default), -- integer = 1 = online, use openeuphoria.org files. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- public procedure EuHelp( sequence word, integer online) sequence pattern, HelpFile = EUDIR & SLASH -- HelpFile starts as: & "docs" & SLASH & "html" & SLASH & "key_index.html" -- key_index.html object line integer start_slice, end_slice, wcmatch, hfn, underscore integer cont = 1, files = 0, maxfiles = 4 -- maximum number of *.html help pages to display. hfn = open(HelpFile, "r") -- opens key_index.html while cont do line = gets(hfn) if hfn = -1 then puts(1, "Couldn't open key_index.html\n") abort(1) end if if atom(line) then -- end of file exit end if files = 0 word = lower(word) line = lower(line) pattern = "*std*" & word & "\">*" pattern = lower(pattern) wcmatch = is_match(pattern, line) if wcmatch then start_slice = match("std", line) files += 1 pattern = "_" & word & "\">" underscore = match(pattern, line) if underscore then pattern = "\">" end_slice = match(pattern, line) end_slice = end_slice -1 HelpFile = line[start_slice..end_slice] -- HelpFile now = help "article" files += 1 if online then -- online index's need to match local html file indexes. -- Maybe when 4.1 is officially released: if ONLINE_INDEX_MATCHES_LOCAL then HelpFile = "http://openeuphoria.org/docs/" & HelpFile else HelpFile = "openeuphoria.org/search/results.wc?manual=1\\&s="&word end if ifdef LINUX then HelpFile = BROWSER & HelpFile end ifdef else -- offline, using local std*.html files ifdef LINUX then HelpFile = BROWSER & "file://" & EUDIR & SLASH & "docs" & SLASH & "html" & SLASH & HelpFile elsifdef WINDOWS then HelpFile = EUDIR & SLASH & "docs" & SLASH & "html" & SLASH & HelpFile end ifdef end if system(HelpFile, 0) end if end if if files = maxfiles then cont = 0 close(hfn) end if end while end procedure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- call EuHelp(search_word) in ed.ex's help routine:--------------- -- if answer[1] = 'y' then -- instead of this line: ----> system(self_command & SLASH & "html" & SLASH & "index.html") EuHelp(search_word, 0) -- call the EuHelp function, or: EuHelp(search_word, 1) -- to use euphoria.org files online. else normal_video() end if end if elsif command[1] = 'l' then ------------------------------------------------------------------------ -- export sequence search_word should be defined in syncolor.e -- I placed it befor the integer color declarations: export sequence search_word = " " --<-------- insert -- edx integer NORMAL_COLOR, ------------------------------------------------------------------------ -- then, in the function SyntaxColor, insert the following line else seg_flush(NORMAL_COLOR) end if search_word = word --<---------- insert ----- ****** seg_end = last