[rkward-cvs] SF.net SVN: rkward-code:[4882] trunk/rkward/packages/rkwarddev

m-eik at users.sf.net m-eik at users.sf.net
Mon Oct 6 21:27:26 UTC 2014


Revision: 4882
          http://sourceforge.net/p/rkward/code/4882
Author:   m-eik
Date:     2014-10-06 21:27:24 +0000 (Mon, 06 Oct 2014)
Log Message:
-----------
rkwarddev: let's see if we can make writing docs for plugins much simpler in the near future...

Modified Paths:
--------------
    trunk/rkward/packages/rkwarddev/ChangeLog
    trunk/rkward/packages/rkwarddev/DESCRIPTION
    trunk/rkward/packages/rkwarddev/NAMESPACE
    trunk/rkward/packages/rkwarddev/R/rk-internal.R
    trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
    trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf

Added Paths:
-----------
    trunk/rkward/packages/rkwarddev/R/rk.get.rkh.prompter.R
    trunk/rkward/packages/rkwarddev/R/rk.set.rkh.prompter.R
    trunk/rkward/packages/rkwarddev/man/rk.get.rkh.prompter.Rd
    trunk/rkward/packages/rkwarddev/man/rk.set.rkh.prompter.Rd

Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog	2014-10-06 19:56:54 UTC (rev 4881)
+++ trunk/rkward/packages/rkwarddev/ChangeLog	2014-10-06 21:27:24 UTC (rev 4882)
@@ -5,6 +5,9 @@
   - the "show" feature in rk.plugin.skeleton() was broken due to changes in the namespace defaults
   - scanning plugin XML code for JS and help related content didn't work as expected in rk.plugin.component()
   - rk.rkh.scan() now also recognises <optioncolumn> and <matrix> nodes
+added:
+  - new functions rk.set.rkh.prompter() and rk.get.rkh.prompter() to make it easier to generate help files
+    (later...)
 
 changes in version 0.06-4 (2014-09-14)
 added:

Modified: trunk/rkward/packages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/packages/rkwarddev/DESCRIPTION	2014-10-06 19:56:54 UTC (rev 4881)
+++ trunk/rkward/packages/rkwarddev/DESCRIPTION	2014-10-06 21:27:24 UTC (rev 4882)
@@ -89,6 +89,7 @@
     'rk.XML.wizard.R'
     'rk.build.plugin.R'
     'rk.get.language.R'
+    'rk.get.rkh.prompter.R'
     'rk.paste.JS.R'
     'rk.paste.JS.graph.R'
     'rk.plotOptions.R'
@@ -108,6 +109,7 @@
     'rk.rkh.title.R'
     'rk.rkh.usage.R'
     'rk.set.language.R'
+    'rk.set.rkh.prompter.R'
     'rk.testsuite.doc.R'
     'rk.uniqueIDs.R'
     'rkwarddev-desc-internal.R'

Modified: trunk/rkward/packages/rkwarddev/NAMESPACE
===================================================================
--- trunk/rkward/packages/rkwarddev/NAMESPACE	2014-10-06 19:56:54 UTC (rev 4881)
+++ trunk/rkward/packages/rkwarddev/NAMESPACE	2014-10-06 21:27:24 UTC (rev 4882)
@@ -68,6 +68,7 @@
 export(rk.build.plugin)
 export(rk.comment)
 export(rk.get.language)
+export(rk.get.rkh.prompter)
 export(rk.paste.JS)
 export(rk.paste.JS.graph)
 export(rk.plotOptions)
@@ -86,6 +87,7 @@
 export(rk.rkh.title)
 export(rk.rkh.usage)
 export(rk.set.language)
+export(rk.set.rkh.prompter)
 export(rk.testsuite.doc)
 export(tf)
 exportClasses(rk.JS.arr)

Modified: trunk/rkward/packages/rkwarddev/R/rk-internal.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk-internal.R	2014-10-06 19:56:54 UTC (rev 4881)
+++ trunk/rkward/packages/rkwarddev/R/rk-internal.R	2014-10-06 21:27:24 UTC (rev 4882)
@@ -1161,3 +1161,16 @@
   }
   return(results)
 } ## end function dependenciesCompatWrapper()
+
+
+## function get.rkh.prompter()
+# returns either an empty list or the contents of rkh.prompter from the internal enviroment 
+get.rkh.prompter <- function(){
+  if(exists("rkh.prompter", envir=.rkdev.env, inherits=FALSE)){
+    rkh.prompter <- as.list(.rkdev.env)[["rkh.prompter"]]
+  } else {
+    assign("rkh.prompter", list(), envir=.rkdev.env)
+    rkh.prompter <- list()
+  }
+  return(rkh.prompter)
+}

Added: trunk/rkward/packages/rkwarddev/R/rk.get.rkh.prompter.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.get.rkh.prompter.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/rk.get.rkh.prompter.R	2014-10-06 21:27:24 UTC (rev 4882)
@@ -0,0 +1,43 @@
+# Copyright 2014 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+#' Get .rkh related information stored internally
+#' 
+#' @param plugin Character string, the name under which you stored information. If \code{NULL},
+#'    returns all information stored in the internal \code{rkh.prompter} list.
+#' @param id Character string, the node ID if a given plugin to search for.  If \code{NULL}, returns
+#'    the full list of the given plugin, otherwise only the help information for the requested node.
+#' @export
+#' @examples
+#' rk.get.rkh.prompter("rk.myPlugin", "someID")
+
+rk.get.rkh.prompter <- function(plugin=NULL, id=NULL){
+  rkh.prompter <- get.rkh.prompter()
+
+  if(is.null(plugin)){
+    return(rkh.prompter)
+  } else {
+    rkh.prompter <- rkh.prompter[[plugin]]
+    if(is.null(id)){
+      return(rkh.prompter)
+    } else {
+      # let's see if we need to extract IDs first
+      id <- check.ID(id)
+      return(rkh.prompter[[id]])
+    }
+  }
+}

Added: trunk/rkward/packages/rkwarddev/R/rk.set.rkh.prompter.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.set.rkh.prompter.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/rk.set.rkh.prompter.R	2014-10-06 21:27:24 UTC (rev 4882)
@@ -0,0 +1,66 @@
+# Copyright 2014 Meik Michalke <meik.michalke at hhu.de>
+#
+# This file is part of the R package rkwarddev.
+#
+# rkwarddev is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# rkwarddev is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with rkwarddev.  If not, see <http://www.gnu.org/licenses/>.
+
+#' Set up an environment to store .rkh related information
+#' 
+#' By using an environment like this, you are able to write information for RKWard help files
+#' directly into your script code of certrain functions, like for radio buttons or checkboxes.
+#' 
+#' The information is temporarily stored in an internal environment, using the plugin name
+#' you specify. Each entry is named after the ID of its respective node. If you later call
+#' \code{\link[rkwarddev:rk.plugin.component]{rk.plugin.component}} (or it is called by other
+#' functions) and you activate the \code{scan} option for rkh files, the scanning process
+#' will try to find a match for each relevant XML node. That is, the info which is stored in the
+#' environment will magically be written into the help file.
+#' 
+#' @param plugin Character string, should be a unique name to identify the current plugin.
+#' @param id Either a character string (the \code{id} of the node to store the help information for),
+#'    or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used).
+#' @param rm Logical, If \code{TRUE} will remove all information stored by the name of \code{plugin} (if
+#'    \code{id=NULL}) or of the given \code{id=NULL}, respectively.
+#' @export
+#' @examples
+#' rk.set.rkh.prompter("rk.myPlugin", "someID", "CLick this to feel funny.")
+
+rk.set.rkh.prompter <- function(plugin, id, help=NULL, rm=FALSE){
+  rkh.prompter <- get.rkh.prompter()
+
+  if(!is.null(id)){
+    # let's see if we need to extract IDs first
+    id <- check.ID(id)
+  } else {}
+  if(isTRUE(rm)){
+    if(is.null(id)){
+      rkh.prompter[[plugin]] <- NULL
+      message(paste0("removed ", plugin, " from rkh.prompter!"))
+    } else {
+      rkh.prompter[[plugin]][[id]] <- NULL
+      message(paste0("removed ", plugin, "[[\"", id, "\"]] from rkh.prompter!"))
+    }
+  } else {
+    if(is.null(rkh.prompter[[plugin]])){
+      rkh.prompter[[plugin]] <- list()
+    } else {}
+    if(is.null(rkh.prompter[[plugin]][[id]])){
+      rkh.prompter[[plugin]][[id]] <- list()
+    } else {}
+   rkh.prompter[[plugin]][[id]][["help"]] <- help
+  }
+
+  assign("rkh.prompter", rkh.prompter, envir=.rkdev.env)
+  return(invisible(NULL))
+}

Modified: trunk/rkward/packages/rkwarddev/inst/NEWS.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/NEWS.Rd	2014-10-06 19:56:54 UTC (rev 4881)
+++ trunk/rkward/packages/rkwarddev/inst/NEWS.Rd	2014-10-06 21:27:24 UTC (rev 4882)
@@ -6,6 +6,7 @@
     \itemize{
       \item the \code{"show"} feature in \code{rk.plugin.skeleton()} was broken due to changes in the namespace defaults
       \item scanning plugin XML code for JS and help related content didn't work as expected in \code{rk.plugin.component()}
+      \item \code{rk.rkh.scan()} now also recognises <optioncolumn> and <matrix> nodes
     }
   }
 }

Modified: trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
===================================================================
(Binary files differ)

Added: trunk/rkward/packages/rkwarddev/man/rk.get.rkh.prompter.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.get.rkh.prompter.Rd	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/man/rk.get.rkh.prompter.Rd	2014-10-06 21:27:24 UTC (rev 4882)
@@ -0,0 +1,24 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{rk.get.rkh.prompter}
+\alias{rk.get.rkh.prompter}
+\title{Get .rkh related information stored internally}
+\usage{
+rk.get.rkh.prompter(plugin = NULL, id = NULL)
+}
+\arguments{
+\item{plugin}{Character string,
+      the name under which you stored information. If \code{NULL},
+returns all information stored in the internal \code{rkh.prompter} list.}
+
+\item{id}{Character string, the node ID if a given plugin to search for.  If \code{NULL},
+      returns
+the full list of the given plugin,
+      otherwise only the help information for the requested node.}
+}
+\description{
+Get .rkh related information stored internally
+}
+\examples{
+rk.get.rkh.prompter("rk.myPlugin", "someID")
+}
+

Added: trunk/rkward/packages/rkwarddev/man/rk.set.rkh.prompter.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.set.rkh.prompter.Rd	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/man/rk.set.rkh.prompter.Rd	2014-10-06 21:27:24 UTC (rev 4882)
@@ -0,0 +1,35 @@
+% Generated by roxygen2 (4.0.1): do not edit by hand
+\name{rk.set.rkh.prompter}
+\alias{rk.set.rkh.prompter}
+\title{Set up an environment to store .rkh related information}
+\usage{
+rk.set.rkh.prompter(plugin, id, help = NULL, rm = FALSE)
+}
+\arguments{
+\item{plugin}{Character string, should be a unique name to identify the current plugin.}
+
+\item{id}{Either a character string (the \code{id} of the node to store the help information for),
+or an object of class \code{XiMpLe.node} (whose \code{id} will be extracted and used).}
+
+\item{rm}{Logical,
+      If \code{TRUE} will remove all information stored by the name of \code{plugin} (if
+\code{id=NULL}) or of the given \code{id=NULL}, respectively.}
+}
+\description{
+By using an environment like this, you are able to write information for RKWard help files
+directly into your script code of certrain functions,
+      like for radio buttons or checkboxes.
+}
+\details{
+The information is temporarily stored in an internal environment, using the plugin name
+you specify. Each entry is named after the ID of its respective node. If you later call
+\code{\link[rkwarddev:rk.plugin.component]{rk.plugin.component}} (or it is called by other
+functions) and you activate the \code{scan} option for rkh files, the scanning process
+will try to find a match for each relevant XML node. That is,
+      the info which is stored in the
+environment will magically be written into the help file.
+}
+\examples{
+rk.set.rkh.prompter("rk.myPlugin", "someID", "CLick this to feel funny.")
+}
+





More information about the rkward-tracker mailing list