[R-wiki] hyperlink to R doc from wiki R script

Philippe Grosjean phgrosjean at sciviews.org
Thu Jan 26 18:27:11 CET 2006


François and the others,
Well, indeed, I must admit I forgot about that "detail" (see François' 
answer hereunder)! So, I am afraid that the only valable solution is 
server-side code (solution 1).

I cooked a page at:

http://www.sciviews.org/_rgui/wiki/doku.php?id=varia:test_calltip

with a couple of propositions for context-sensitive help about R 
functions, and also for calltips on Wiki pages. It is feasible, but 
requires some coding (a rhelp.php engine is required, and an 
''index.conf'' file must be computed by the 'Rdconv-to-Wiki' R code).

Those are pending tasks in my (already huge) TODO list... but first, I 
would appreciate your comments. Please, feel free to edit the 
corresponding Wiki page.

Best,

Philippe Grosjean

francoisromain at free.fr wrote:
> Selon Philippe Grosjean <phgrosjean at sciviews.org>:
> 
> 
>>Romain Francois wrote:
>>
>>>Hi wiki people,
>>>
>>>I don't know what tool is used for colouring the R scripts that go into
>>>the wiki, probably highlight, the <span class="kw2">... seem familiar ....
>>>I wonder if that may be possible that the code link to (wiki) help pages
>>>for functions.
>>>For example, if one writes that script :
>>>
>>>a <- rnorm(100)
>>>mean(a)
>>>
>>>
>>>One could imagine that for example the words 'mean' and 'rnorm' might be
>>>clickable and then link to
>>>http://www.sciviews.org/_rgui/wiki/doku.php?id=rdoc:base:mean
>>>http://www.sciviews.org/_rgui/wiki/doku.php?id=rdoc:stats:rnorm
>>>
>>>I've done that kind of thing torturing (with R) the output of highlight
>>>for RGG.
>>>Maybe I can share that, but do not wait for something very pretty ;-)
>>>What about writing a perl? python? script to do that kind of task, or
>>>even modifying highlight ?
>>>
>>>What do you think ?
>>>
>>>Romain
>>
>>This is indeed and excellent idea! (By the way, the syntax highlighting
>>engine is GeSHi).
>>
>>There are two ways to achieve this:
>>1) The Wiki engine hardcodes the link in the HTML version of the Wiki
>>page (that is, a <a href = ...>...</a>).
>>
>>2) Make it possible to jump to the corresponding man page when one
>>highlights a function name and click a specific hotkey (Ctrl + F1?).
>>This should be a little JavaScript function executed on the browser.
>>
>>Solution 1 has the advantage of being compatible with all browsers.
>>Solution 2 is saving computation, because the link is computed only when
>>request by the user... and on the client.
> 
> 
> But, with solution 2, the users are not encouraged to click when their mouse
> crosses the name of the function. That should not be a problem, when it's done,
> we can just write somewhere that this functionnality exists.
> 
> I will try to write the 10 lines javascript function, that gets the text that is
> currently highlighted by the user and tries to go to its help page. But, in that
> game, how would javascript know in which package the function is ? Is there
> already a file somewhere like that :
> 
> mean base
> glm stats
> ...
> 
> or is there a smarter way to do that ? because, if all CRAN packages help pages
> are wikified, that sort of file will be huge
> 
> 
> ... to be continued
> 
> Romain
> 
> 
>>There are, at least two reasons why solution 2 would be better:
>>1) The Wiki engine is already using much server CPU to compute HTML
>>versions of the Wiki pages (note the superiority of DokuWiki over a
>>couple of other Wiki engines here, because it has a cache mechanism
>>where he stores chunks of xhtml which are not recalculated every time).
>>
>>2) I am still convincing we should be able to compile a given set of
>>pages and all linked pages into a single PDF file (there are a couple of
>>possible solutions to do so). If links to function help is hardcoded in
>>the HTML code, and the pdf is computed after HTML, then, all man pages
>>will be automatically included in the PDF, which is certainly not what
>>one is looking for.
>>
>>So, would anybody like to write that little function in JavaScript (this
>>is no more than 10 lines of code, indeed)?
>>
>>Best,
>>
>>Philippe Grosjean
>>
>>P.S.: it would be nice to extend the acronym definition (look at the
>>start page for URL or RSS, for instance) to provide also a definition
>>for main functions (those in base packages, for instance). This is just
>>a mather of adding entries in a definition file in DokuWiki. I will look
>>at that.
>>
>>
>>
> 
> 
> 
> 
>



More information about the R-sig-wiki mailing list