[R-wiki] Can't understand how to insert wiki pages and make (oldstyle) alltips work
Philippe Grosjean
phgrosjean at sciviews.org
Wed Jun 28 10:39:05 CEST 2006
Hello Paul,
I think that Ben answered your question correctly, and I will give a
little bit more explanation on how and why the Wiki works like that:
1) "I even can't navigate the Wiki with javascript turned off". Well, I
must say I always use Javascript with reasonable security levels. so, I
tend to assume what works on my computer should work on other ones! Now,
turning javascript off is aq legitimate right,... and the Wiki should
work that way. Most of javascript parts (like ASCIIMathML, for instance)
could be turned into a php of server-side javascript code. The only
javascript that MUST be executed on the client is the folding of table
of contents. This is why you cannot navigate without javascript: because
you cannot unfold sections to reveal their content. I must work on this
and unfold all sections by default in case javascript is not activated.
I put those aspects on the TODO list, but not as a top priority.
2) There are three ways to create a new wiki page: (1) type its "path",
like 'tips:graphics-base:0savegraphs' in the search box, click 'search'
and then, create the page, (2) do the same, but type the whole URL in
the navigator:
'http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base:0savegraphs'.
A little bit more painful, but same results, (3) create a link to your
nex page at the right location, then navigate to it and click 'Create
this page' on the screen telling that the page does not exists. The
third way is *warmly recommended*. So, if you navigate to
tips:graphics-base and add you link with explicit description on the
page, then, everything is right: your page appears everywhere it should
be (tips:tips, description and full content (page names) of
tips:graphics-base). That way, it is very easy to both keep coherence on
the site and create new tips.
3) List of pages, not descriptions in tips:tips and "full content"
section: this is managed automatically by a plugin. As already
sugfgested (Ben Bolker?), it should be better to have the full
decription of the page there. I need to rework the plugin for that. This
is on the TODO list. Current navigation in tips is the best I can do
with current version of this index plugin.
4) "I got only old versions with:
rawimport <-
readLines("http://wiki.r-project.org/rwiki/doku.php?id=tips:tips&rev=1150068302&do=export_raw")"
You should know that the Wiki keeps ALL versions of ALL documents. An
URL lile this does retrieves a given old version of tips:tips. So, don't
be surprized if it is not up-to-date!
5) "rawimport <-
readLines("http://wiki.r-project.org/rwiki/doku.php?id=tips:tips&do=export_raw")
Well, not any more. It returns the major headings, not the titles
individual items (like it used to)." You have certainly noticed that
tips:tips was deeply reworked to match the new and more flexible
navigation system. The problem is: your script should NOT be based on
the content of any page to retrieve an INDEX of pages! If you want to
get the index of all pages in a given section, you should navigate to
this particular index. The difficulty is that the index cannot be
exported in raw format. So, we need to retrieve the xHTML version. That
complicates a little bit the search. Here is the function that does the
job. That function is safe now, since the way the index is displayed
will not change, on the contrary of wiki pages:
"getWikiTipsIndex" <-
function() {
## First of all, we need to get the list of all subsections in tips
stips <- readLines("http://wiki.r-project.org/rwiki/doku.php?id=&idx=tips")
# Keep only lines related to tips sections
stips <- stips[grep("idx=tips:", stips)]
# Retrieve the sections from these lines
stips <- sub("^.*(idx=tips:[^\"]*).*$", "\\1", stips)
# Cycle through all the tips subsections and retrieve the list of pages
ltips <- character(0)
for(st in stips) {
Ltips <- readLines(paste("http://wiki.r-project.org/rwiki/doku.php?id=",
st, sep = "&"))
# Keep only lines related to tips pages in that section
Ltips <- Ltips[grep("<li class=\"level3\">", Ltips)]
if (!is.null(Ltips) && length(Ltips) > 0) {
# Retrieve the path to the pages from that list
ltips <- c(ltips, sub("^.*id=(tips:[^\"]*).*$", "\\1", Ltips))
}
}
return(ltips)
}
getWikiTipsIndex()
I'll write or update a page about this. Note that such a function (plus
your code to generate the classic appearance of Rtips) should be
collected together with othert useful R Wiki functions to constitute the
future rwiki package.
I hop I answered all your questions clearly enough.
Best,
Philippe Grosjean
..............................................<°}))><........
) ) ) ) )
( ( ( ( ( Prof. Philippe Grosjean
) ) ) ) )
( ( ( ( ( Numerical Ecology of Aquatic Systems
) ) ) ) ) Mons-Hainaut University, Pentagone (3D08)
( ( ( ( ( Academie Universitaire Wallonie-Bruxelles
) ) ) ) ) 8, av du Champ de Mars, 7000 Mons, Belgium
( ( ( ( (
) ) ) ) ) phone: + 32.65.37.34.97, fax: + 32.65.37.30.54
( ( ( ( ( email: Philippe.Grosjean at umh.ac.be
) ) ) ) )
( ( ( ( ( web: http://www.umh.ac.be/~econum
) ) ) ) ) http://www.sciviews.org
( ( ( ( (
..............................................................
Paul Johnson wrote:
> Thanks. I put in my own menu item under Base (standard) graphics here:
>
> http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base
>
> Now I just need help from Phillipe on making the rawexport do what it used to.
>
> On 6/27/06, Ben Bolker <bolker at ufl.edu> wrote:
>
>>rawimport <-
>>readLines("http://wiki.r-project.org/rwiki/doku.php?id=tips:tips&do=export_raw")
>>
>>(just guessing)?
>>
>
> Well, not any more. It returns the major headings, not the titles
> individual items (like it used to).
> Here is what you get now:
>
>
>>rawimport
>
> [1] "====== R Wiki - Tips ======"
> [2] "A collection of short pages with R code examples (\"snippets\")
> ((This section is inspired and initially filled with the excellent
> material from //Paul Johnson// known as
> [[http://www.ku.edu/~pauljohn/R/Rtips.html#1.1|Rtips]].))..."
> [3] ""
> [4] "<note classic>"
> [5] "For those who migrate Paul Johnson's Rtips, please, update the
> [[misc:rtips-status|Rtips status]] page."
> [6] "</note>"
> [7] ""
> [8] "==== Data ===="
> [9] "++++ Input-output | {{indexmenu>tips:data-io}} ++++"
> [10] "++++ Data frames | {{indexmenu>tips:data-frames}} ++++"
> [11] "++++ Lists | {{indexmenu>tips:data-lists}} ++++"
> [12] "++++ Matrices & arrays | {{indexmenu>tips:data-matrices}} ++++"
> [13] "++++ Vectors | {{indexmenu>tips:data-vectors}} ++++"
> [14] "++++ Factors | {{indexmenu>tips:data-factors}} ++++"
> [15] "++++ Manipulation | {{indexmenu>tips:data-manip}} ++++"
> [16] "++++ Databases | {{indexmenu>tips:data-bases}} ++++"
>
> [and so forth]
>
> The items are hidden behind "{indexmenu>...".
>
> I need is some http:// style way to get the menuitems that you see
> when you click. Those items are there hidden in the html, javascript
> reveals them.
>
> I think I could download the html output and postprocess it in Perl (a
> more comfortable zone for me than R, actually), but I really think
> that won't be necessary.
>
> While I'm asking about http:// uses, suppose I want to create another
> page that has a link that points at the right to edit an item. In the
> Wiki's current format, one must click log in and then the edit button
> appears.
>
> I need a one step way to ask to edit a particular item, at which point
> the user is asked for a username & password. Something like a
> "revise" option to pass through in the CGI part of the URL.
>
> http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-base:0savegraphs&revise=true
>
> Possible? I've seen that in Perl based Wiki programs, but don't know
> about this Php/Javascript kind.
>
> pj
>
> pj
>
>
More information about the R-sig-wiki
mailing list