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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Sat Oct 22 22:32:15 UTC 2011


Revision: 3989
          http://rkward.svn.sourceforge.net/rkward/?rev=3989&view=rev
Author:   m-eik
Date:     2011-10-22 22:32:15 +0000 (Sat, 22 Oct 2011)
Log Message:
-----------
rkwarddev: adding support for comments and CDATA in logic sections; also support for doPrintout in javascript

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/R/rk.JS.doc.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.context.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.dialog.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.embed.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.hierarchy.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.logic.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.menu.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.page.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.pluginmap.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.snippets.R
    trunk/rkward/packages/rkwarddev/R/rk.XML.wizard.R
    trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R
    trunk/rkward/packages/rkwarddev/R/rk.plugin.component.R
    trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R
    trunk/rkward/packages/rkwarddev/R/rk.rkh.settings.R
    trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
    trunk/rkward/packages/rkwarddev/inst/CITATION
    trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
    trunk/rkward/packages/rkwarddev/man/rk.JS.doc.Rd
    trunk/rkward/packages/rkwarddev/man/rk.XML.embed.Rd
    trunk/rkward/packages/rkwarddev/man/rk.paste.JS.Rd
    trunk/rkward/packages/rkwarddev/man/rk.plugin.component.Rd
    trunk/rkward/packages/rkwarddev/man/rk.plugin.skeleton.Rd
    trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd

Added Paths:
-----------
    trunk/rkward/packages/rkwarddev/R/rk.comment.R
    trunk/rkward/packages/rkwarddev/man/rk.comment.Rd

Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/ChangeLog	2011-10-22 22:32:15 UTC (rev 3989)
@@ -1,5 +1,13 @@
 ChangeLog for package rkwarddev
 
+## 0.04-3 (2011-10-22)
+  - added support for definint doPrintout() JS functions to rk.JS.doc(), rk.plugin.skeleton() and
+    rk.plugin.component()
+  - added function rk.comment() to add comments to the generated code. it's a <!-- comment --> node
+    by default, but will be turned into // comment by rk.paste.JS() and <![CDATA[ comment ]]> for
+    logic sections automatically
+  - fixed missing "id.name" option in rk.XML.embed()
+
 ## 0.04-2 (2011-10-21)
   - removed the superfluous "name" option from rk.plugin.skeleton() and rk.plugin.component(); names are now
     always provided by "about", either as an <about> node or just the name.

Modified: trunk/rkward/packages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/packages/rkwarddev/DESCRIPTION	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/DESCRIPTION	2011-10-22 22:32:15 UTC (rev 3989)
@@ -14,8 +14,8 @@
 URL: http://rkward.sourceforge.net
 Authors at R: c(person(given="Meik", family="Michalke",
     email="meik.michalke at hhu.de", role=c("aut", "cre")))
-Version: 0.04-2
-Date: 2011-10-21
+Version: 0.04-3
+Date: 2011-10-22
 Collate:
     'echo.R'
     'id.R'
@@ -23,6 +23,7 @@
     'ite.R'
     'qp.R'
     'rk.build.plugin.R'
+    'rk.comment.R'
     'rk-internal.R'
     'rk.JS.array.R'
     'rk.JS.arr-class.R'

Modified: trunk/rkward/packages/rkwarddev/NAMESPACE
===================================================================
--- trunk/rkward/packages/rkwarddev/NAMESPACE	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/NAMESPACE	2011-10-22 22:32:15 UTC (rev 3989)
@@ -9,6 +9,7 @@
 exportMethods(show)
 export(qp)
 export(rk.build.plugin)
+export(rk.comment)
 export(rk.JS.array)
 export(rk.JS.doc)
 export(rk.JS.options)

Modified: trunk/rkward/packages/rkwarddev/R/rk-internal.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk-internal.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk-internal.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -161,7 +161,7 @@
 #   <tag id="my.id" ...>
 # in XML will become
 #   var my.id = getValue("my.id");
-get.JS.vars <- function(JS.var, XML.var=NULL, JS.prefix="", names.only=FALSE, modifiers=NULL, default=FALSE, join=""){
+get.JS.vars <- function(JS.var, XML.var=NULL, JS.prefix="", names.only=FALSE, modifiers=NULL, default=FALSE, join="", check.modifiers=TRUE){
 	# check for XiMpLe nodes
 	JS.var <- check.ID(JS.var)
 	if(!is.null(XML.var)){
@@ -184,7 +184,9 @@
 				} else {
 					modif.tag.name <- "all"
 				}
-				modifiers <- modifiers[modif.validity(modif.tag.name, modifier=child.list(modifiers), warn.only=TRUE, bool=TRUE)]
+				if(isTRUE(check.modifiers)){
+					modifiers <- modifiers[modif.validity(modif.tag.name, modifier=child.list(modifiers), warn.only=TRUE, bool=TRUE)]
+				} else {}
 			}
 		} else {}
 		XML.var <- check.ID(XML.var)
@@ -406,7 +408,8 @@
 	saveobject=c("selection", "parent", "objectname", "active"),
 	spinbox=c("int", "real"),
 	formula=c("model", "table", "labels", "fixed_factors", "dependent"),
-	embed=c("code"),
+# removed embed, can be all sorts of stuff, see e.g. generic plot options
+#	embed=c("code"),
 	preview=c("state")
 ) ## end list with valid modifiers
 
@@ -425,6 +428,14 @@
 
 	if(inherits(source, "XiMpLe.node")){
 		tag.name <- source at name
+		# embedded plugins can have all sorts of modifiers
+		if(identical(tag.name, "embed")){
+			if(isTRUE(bool)){
+				return(TRUE)
+			} else {
+				return(modifier)
+			}
+		} else {}
 	} else if(identical(source, "all")){
 		tag.name <- "<any tag>"
 	} else {

Modified: trunk/rkward/packages/rkwarddev/R/rk.JS.doc.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.doc.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.doc.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -11,7 +11,9 @@
 #' @param calculate A character string to be included in the \code{calculate()} function. This string will be
 #'		pasted as-is, after \code{variables} has been evaluated.
 #' @param printout A character string to be included in the \code{printout()} function. This string will be
-#'		pasted as-is, after \code{results.header} has been evaluated.
+#'		pasted as-is, after \code{results.header} has been evaluated. Ignored if \code{doPrintout} is set.
+#' @param doPrintout A character string to be included in the \code{doPrintout()} function. This string will be
+#'		pasted as-is. You don't need to define a \code{preview()} function, as this will be added automatically. Use \code{ite("full", ...)} style JavaScript code to include headers etc.
 #' @param indent.by A character string defining how indentation should be done.
 #' @return A character string.
 #' @seealso \code{\link[rkwarddev:rk.paste.JS]{rk.paste.JS}},
@@ -24,7 +26,7 @@
 #' @export
 
 rk.JS.doc <- function(require=c(), variables=NULL, results.header=NULL,
-	preprocess=NULL, calculate=NULL, printout=NULL, indent.by="\t"){
+	preprocess=NULL, calculate=NULL, printout=NULL, doPrintout=NULL, indent.by="\t"){
 
 	js.require <- unlist(sapply(require, function(this.req){
 			paste(indent(2, by=indent.by), "echo(\"require(", this.req, ")\\n\");\n", sep="")
@@ -43,12 +45,31 @@
 			"}", sep="")
 		
 	js.printout <- paste("function printout(){\n",
-				indent(2, by=indent.by), "// printout the results\n",
-				indent(2, by=indent.by), "echo(\"rk.header(\\\"", results.header,"\\\", level=1)\\n\");\n",
-				ifelse(is.null(printout), paste(indent(2, by=indent.by), "echo(\"rk.print(\\\"\\\")\\n\");", sep=""), printout),
-				"\n}", sep="")
+				if(is.null(doPrintout)){paste(
+					indent(2, by=indent.by), "// printout the results\n",
+					indent(2, by=indent.by), "echo(\"rk.header(\\\"", results.header,"\\\", level=1)\\n\");\n",
+					ifelse(is.null(printout), paste(indent(2, by=indent.by), "echo(\"rk.print(\\\"\\\")\\n\");", sep=""), printout),
+					sep="")
+				} else {paste(
+					indent(2, by=indent.by), "// all the real work is moved to a custom defined function doPrintout() below\n",
+					indent(2, by=indent.by), "// true in this case means: We want all the headers that should be printed in the output:\n",
+					indent(2, by=indent.by), "doPrintout(true);",
+					sep="")
+				}, "\n}", sep="")
 
-	JS.doc <- paste(js.preprocess, js.calculate, js.printout, sep="\n\n")
+	# this part will create preview() and doPrintout(full), if needed
+	if(is.null(doPrintout)){
+		js.doPrintout <- ""
+	} else {
+		js.doPrintout <- paste("function preview(){\n",
+					indent(2, by=indent.by), "preprocess();\n",
+					indent(2, by=indent.by), "calculate();\n",
+					indent(2, by=indent.by), "doPrintout(false);\n}\n\n",
+					"function doPrintout(full){\n", doPrintout, "\n}",
+				sep="")
+	}
 
+	JS.doc <- paste(js.preprocess, js.calculate, js.printout, js.doPrintout, sep="\n\n")
+
 	return(JS.doc)
 }

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.context.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.context.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.context.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -31,7 +31,7 @@
 		stop(simpleError(paste("Invalid ID: ", id, sep="")))
 	} else {}
 		
-	invalid.sets <- !node.names %in% c("menu")
+	invalid.sets <- !node.names %in% c("menu", "!--")
 	if(any(invalid.sets)){
 		stop(simpleError(paste("Invalid XML nodes for context section: ",
 			paste(node.names[invalid.sets], collapse=", "), sep="")))

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.dialog.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.dialog.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.dialog.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -31,7 +31,7 @@
 	invalid.sets <- !node.names %in% c("browser", "checkbox", "column", "copy",
 		"dropdown", "embed", "formula", "frame", "include", "input", "insert",
 		"preview", "radio", "row", "saveobject", "spinbox", "stretch", "tabbook",
-		"text", "varselector", "varslot")
+		"text", "varselector", "varslot", "!--")
 	if(any(invalid.sets)){
 		stop(simpleError(paste("Invalid XML nodes for dialog section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
 	} else {}

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.embed.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.embed.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.embed.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -3,6 +3,8 @@
 #' @param component A character string, registered name (\code{id} in pluginmap file) of the component to be embedded.
 #' @param button Logical, whether the plugin should be embedded as a button and appear if it's pressed.
 #' @param label A character string, text label for the button (only used if \code{button=TRUE}).
+#' @param id.name Character string, a unique ID for this plugin element.
+#'		If \code{"auto"}, an ID will be generated automatically from the label and component strings.
 #' @return An object of class \code{XiMpLe.node}.
 #' @export
 #' @seealso \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
@@ -10,7 +12,7 @@
 #' test.embed <- rk.XML.embed("someComponent")
 #' cat(pasteXMLNode(test.embed))
 
-rk.XML.embed <- function(component, button=FALSE, label="Options"){
+rk.XML.embed <- function(component, button=FALSE, label="Options", id.name="auto"){
 	attr.list <- list(component=component)
 
 	if(isTRUE(button)){
@@ -21,6 +23,12 @@
 		attr.list[["label"]] <- label
 	} else {}
 
+	if(identical(id.name, "auto")){
+		attr.list[["id"]] <- auto.ids(paste(label, component, sep=""), prefix=ID.prefix("embed"))
+	} else {
+		attr.list[["id"]] <- id.name
+	}
+
 	node <- new("XiMpLe.node",
 			name="embed",
 			attributes=attr.list

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.hierarchy.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.hierarchy.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.hierarchy.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -27,7 +27,7 @@
 			this.node at name
 		})
 
-	invalid.sets <- !node.names %in% c("menu")
+	invalid.sets <- !node.names %in% c("menu", "!--")
 	if(any(invalid.sets)){
 		stop(simpleError(paste("Invalid XML nodes for hierarchy section: ",
 			paste(node.names[invalid.sets], collapse=", "), sep="")))

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.logic.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.logic.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.logic.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -30,12 +30,20 @@
 rk.XML.logic <- function(...){
 	nodes <- list(...)
 
+	# transform "!--" comment nodes into "![CDATA[" for scripting logic
+	nodes <- sapply(child.list(nodes), function(this.node){
+			if(identical(this.node at name, "!--")){
+				this.node at name <- "![CDATA["
+			} else {}
+			return(this.node)
+		})
+
 	# check the node names and allow only valid ones
 	node.names <- sapply(child.list(nodes), function(this.node){
 			this.node at name
 		})
 
-	invalid.sets <- !node.names %in% c("connect", "convert","include","insert","external","set")
+	invalid.sets <- !node.names %in% c("connect", "convert","include","insert","external","set","![CDATA[")
 	if(any(invalid.sets)){
 		stop(simpleError(paste("Invalid XML nodes for logic section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
 	} else {}

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.menu.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.menu.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.menu.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -87,7 +87,7 @@
 	sapply(child.list(nodes), function(this.node){
 			stopifnot(inherits(this.node, "XiMpLe.node"))
 			node.name <- this.node at name
-			if(!node.name %in% c("entry", "menu")){
+			if(!node.name %in% c("entry", "menu", "!--")){
 				stop(simpleError(paste("Invalid XML nodes for menu section: ", node.name, sep="")))
 			} else {}
 		})

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.page.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.page.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.page.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -32,7 +32,7 @@
 
 	invalid.sets <- !node.names %in% c("browser", "checkbox", "column", "copy",
 		"dropdown", "formula", "frame", "input", "page", "radio", "row", "saveobject",
-		"spinbox", "stretch", "tabbook", "text", "varselector", "varslot")
+		"spinbox", "stretch", "tabbook", "text", "varselector", "varslot", "!--")
 	if(any(invalid.sets)){
 		stop(simpleError(paste("Invalid XML nodes for page/wizard section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
 	} else {}

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.pluginmap.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.pluginmap.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.pluginmap.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -183,6 +183,7 @@
 					id.names <- sapply(this.hier, function(hier.id){
 							return(clean.name(hier.id))
 						})
+
 					hier.XML <- rk.XML.menu(
 						label=unlist(main.menu[this.hier[[1]]]),
 						new.hierarchy,

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.snippets.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.snippets.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.snippets.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -24,7 +24,7 @@
 	sapply(child.list(nodes), function(this.node){
 			stopifnot(inherits(this.node, "XiMpLe.node"))
 			node.name <- this.node at name
-			if(!identical(node.name, "snippet")){
+			if(!identical(node.name, "snippet", "!--")){
 				stop(simpleError(paste("Invalid XML nodes for snippets section: ", node.name, sep="")))
 			} else {}
 		})

Modified: trunk/rkward/packages/rkwarddev/R/rk.XML.wizard.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.XML.wizard.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.XML.wizard.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -32,7 +32,7 @@
 	invalid.sets <- !node.names %in% c("browser", "checkbox", "column", "copy",
 		"dropdown", "embed", "formula", "frame", "include", "input", "insert",
 		"page", "preview", "radio", "row", "saveobject", "spinbox", "stretch",
-		"tabbook", "text", "varselector", "varslot")
+		"tabbook", "text", "varselector", "varslot", "!--")
 	if(any(invalid.sets)){
 		stop(simpleError(paste("Invalid XML nodes for wizard section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
 	} else {}

Added: trunk/rkward/packages/rkwarddev/R/rk.comment.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.comment.R	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/R/rk.comment.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -0,0 +1,16 @@
+#' Create comment for RKWard plugin code
+#'
+#' @param text Character string, the text to be displayed.
+#' @return An object of class \code{XiMpLe.node}.
+#' @export
+#' @examples
+#' test.comment <- rk.comment("Added this text.")
+#' cat(pasteXMLNode(test.comment))
+
+rk.comment <- function(text){
+	node <- new("XiMpLe.node",
+			name="!--",
+			value=text)
+
+	return(node)
+}

Modified: trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -3,6 +3,8 @@
 #' @note To get a list of the implemented modifiers in this package, call \code{rkwarddev:::all.valid.modifiers}.
 #'
 #' @param ... Objects of class \code{rk.JS.ite}, \code{rk.JS.arr}, \code{rk.JS.opt} or character.
+#'		Another special case is XiMpLe nodes created by \code{rk.comment()}, which will be turned
+#'		into JavaScript comments (i.e., lines starting with "//").
 #' @param level Integer, which indentation level to use, minimum is 1.
 #' @param indent.by A character string defining the indentation string to use.
 #' @param funct For \code{rk.JS.arr} and \code{rk.JS.opt} objects only: Character string, name of the R function
@@ -47,6 +49,14 @@
 		} else if(inherits(this.object, "rk.JS.var")){
 			result <- paste.JS.var(this.object, level=level, indent.by=indent.by, JS.prefix=var.prefix,
 				modifiers=modifiers, default=default, join=join)
+		} else if(inherits(this.object, "XiMpLe.node")){
+			if(identical(this.object at name, "!--")){
+				result <- paste(indent(level, by=indent.by),
+					"// ",
+					gsub("\n", paste("\n", indent(level, by=indent.by), "//", sep=""), this.object at value), sep="")
+			} else {
+				stop(simpleError("XiMpLe.node objects are only valid if they are comments!"))
+			}
 		} else {
 			result <- paste(indent(level, by=indent.by), this.object, sep="")
 		}

Modified: trunk/rkward/packages/rkwarddev/R/rk.plugin.component.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.plugin.component.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.plugin.component.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -9,7 +9,7 @@
 #'		If not set, their default values are used. See \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}} for details.
 #' @param js A named list of options to be forwarded to \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}}, to generate the JavaScript file.
 #'		Not all options are supported because some don't make sense in this context. Valid options are:
-#'		\code{"require"}, \code{"results.header"}, \code{"variables"}, \code{"preprocess"}, \code{"calculate"} and \code{"printout"}.
+#'		\code{"require"}, \code{"results.header"}, \code{"variables"}, \code{"preprocess"}, \code{"calculate"}, \code{"printout"} and \code{"doPrintout"}.
 #'		If not set, their default values are used. See \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}} for details.
 #' @param rkh A named list of options to be forwarded to \code{\link[rkwarddev:rk.rkh.doc]{rk.rkh.doc}}, to generate the help file.
 #'		Not all options are supported because some don't make sense in this context. Valid options are:
@@ -128,7 +128,7 @@
 	## create plugin.js
 	if("js" %in% create & length(js) > 0){
 		got.JS.options <- names(js)
-		for (this.opt in c("require", "variables", "preprocess", "calculate", "printout")){
+		for (this.opt in c("require", "variables", "preprocess", "calculate", "printout", "doPrintout")){
 			if(!this.opt %in% got.JS.options) {
 				js[[this.opt]] <- eval(formals(rk.JS.doc)[[this.opt]])
 			} else {}
@@ -158,6 +158,7 @@
 			preprocess=js[["preprocess"]],
 			calculate=js[["calculate"]],
 			printout=js[["printout"]],
+			doPrintout=js[["doPrintout"]],
 			indent.by=indent.by)
 		this.component at js <- JS.code
 	} else {

Modified: trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -27,7 +27,7 @@
 #'		If not set, their default values are used. See \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}} for details.
 #' @param js A named list of options to be forwarded to \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}}, to generate the JavaScript file.
 #'		Not all options are supported because some don't make sense in this context. Valid options are:
-#'		\code{"require"}, \code{"results.header"}, \code{"variables"}, \code{"preprocess"}, \code{"calculate"} and \code{"printout"}.
+#'		\code{"require"}, \code{"results.header"}, \code{"variables"}, \code{"preprocess"}, \code{"calculate"}, \code{"printout"} and \code{"doPrintout"}.
 #'		If not set, their default values are used. See \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}} for details.
 #' @param pluginmap A named list of options to be forwarded to \code{\link[rkwarddev:rk.XML.pluginmap]{rk.XML.pluginmap}}, to generate the pluginmap file.
 #'		Not all options are supported because some don't make sense in this context. Valid options are:

Modified: trunk/rkward/packages/rkwarddev/R/rk.rkh.settings.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.rkh.settings.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rk.rkh.settings.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -30,7 +30,7 @@
 			this.node at name
 		})
 
-	invalid.sets <- !node.names %in% c("setting", "caption")
+	invalid.sets <- !node.names %in% c("setting", "caption", "!--")
 	if(any(invalid.sets)){
 		stop(simpleError(paste("Invalid XML nodes for settings section: ", paste(node.names[invalid.sets], collapse=", "), sep="")))
 	} else {}

Modified: trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R	2011-10-22 22:32:15 UTC (rev 3989)
@@ -3,8 +3,8 @@
 #' \tabular{ll}{
 #' Package: \tab rkwarddev\cr
 #' Type: \tab Package\cr
-#' Version: \tab 0.04-2\cr
-#' Date: \tab 2011-10-21\cr
+#' Version: \tab 0.04-3\cr
+#' Date: \tab 2011-10-22\cr
 #' Depends: \tab R (>= 2.9.0),XiMpLe,rkward (>= 0.5.7)\cr
 #' Enhances: \tab rkward\cr
 #' Encoding: \tab UTF-8\cr

Modified: trunk/rkward/packages/rkwarddev/inst/CITATION
===================================================================
--- trunk/rkward/packages/rkwarddev/inst/CITATION	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/inst/CITATION	2011-10-22 22:32:15 UTC (rev 3989)
@@ -2,12 +2,12 @@
 		title="rkwarddev: A collection of tools for RKWard plugin development",
 		author="Meik Michalke",
 		year="2011",
-		note="(Version 0.04-2)",
+		note="(Version 0.04-3)",
 		url="http://rkward.sourceforge.net",
 
 		textVersion =
 		paste("Michalke, M. (2011). ",
-				"rkwarddev: A collection of tools for RKWard plugin development (Version 0.04-2). ",
+				"rkwarddev: A collection of tools for RKWard plugin development (Version 0.04-3). ",
 				"Available from http://rkward.sourceforge.net",
 				sep=""),
 

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

Modified: trunk/rkward/packages/rkwarddev/man/rk.JS.doc.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.JS.doc.Rd	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/man/rk.JS.doc.Rd	2011-10-22 22:32:15 UTC (rev 3989)
@@ -4,7 +4,7 @@
 \usage{
   rk.JS.doc(require = c(), variables = NULL, results.header
   = NULL, preprocess = NULL, calculate = NULL, printout =
-  NULL, indent.by = "\t")
+  NULL, doPrintout = NULL, indent.by = "\t")
 }
 \arguments{
   \item{require}{A character vector with names of R
@@ -28,8 +28,16 @@
 
   \item{printout}{A character string to be included in the
   \code{printout()} function. This string will be pasted
-  as-is, after \code{results.header} has been evaluated.}
+  as-is, after \code{results.header} has been evaluated.
+  Ignored if \code{doPrintout} is set.}
 
+  \item{doPrintout}{A character string to be included in
+  the \code{doPrintout()} function. This string will be
+  pasted as-is. You don't need to define a \code{preview()}
+  function, as this will be added automatically. Use
+  \code{ite("full", ...)} style JavaScript code to include
+  headers etc.}
+
   \item{indent.by}{A character string defining how
   indentation should be done.}
 }

Modified: trunk/rkward/packages/rkwarddev/man/rk.XML.embed.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.XML.embed.Rd	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/man/rk.XML.embed.Rd	2011-10-22 22:32:15 UTC (rev 3989)
@@ -3,7 +3,7 @@
 \title{Create XML node "embed" for RKWard plugins}
 \usage{
   rk.XML.embed(component, button = FALSE, label =
-  "Options")
+  "Options", id.name = "auto")
 }
 \arguments{
   \item{component}{A character string, registered name
@@ -15,6 +15,10 @@
 
   \item{label}{A character string, text label for the
   button (only used if \code{button=TRUE}).}
+
+  \item{id.name}{Character string, a unique ID for this
+  plugin element. If \code{"auto"}, an ID will be generated
+  automatically from the label and component strings.}
 }
 \value{
   An object of class \code{XiMpLe.node}.

Added: trunk/rkward/packages/rkwarddev/man/rk.comment.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.comment.Rd	                        (rev 0)
+++ trunk/rkward/packages/rkwarddev/man/rk.comment.Rd	2011-10-22 22:32:15 UTC (rev 3989)
@@ -0,0 +1,20 @@
+\name{rk.comment}
+\alias{rk.comment}
+\title{Create comment for RKWard plugin code}
+\usage{
+  rk.comment(text)
+}
+\arguments{
+  \item{text}{Character string, the text to be displayed.}
+}
+\value{
+  An object of class \code{XiMpLe.node}.
+}
+\description{
+  Create comment for RKWard plugin code
+}
+\examples{
+test.comment <- rk.comment("Added this text.")
+cat(pasteXMLNode(test.comment))
+}
+

Modified: trunk/rkward/packages/rkwarddev/man/rk.paste.JS.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.paste.JS.Rd	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/man/rk.paste.JS.Rd	2011-10-22 22:32:15 UTC (rev 3989)
@@ -8,7 +8,10 @@
 }
 \arguments{
   \item{...}{Objects of class \code{rk.JS.ite},
-  \code{rk.JS.arr}, \code{rk.JS.opt} or character.}
+  \code{rk.JS.arr}, \code{rk.JS.opt} or character. Another
+  special case is XiMpLe nodes created by
+  \code{rk.comment()}, which will be turned into JavaScript
+  comments (i.e., lines starting with "//").}
 
   \item{level}{Integer, which indentation level to use,
   minimum is 1.}

Modified: trunk/rkward/packages/rkwarddev/man/rk.plugin.component.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.plugin.component.Rd	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/man/rk.plugin.component.Rd	2011-10-22 22:32:15 UTC (rev 3989)
@@ -34,10 +34,10 @@
   because some don't make sense in this context. Valid
   options are: \code{"require"}, \code{"results.header"},
   \code{"variables"}, \code{"preprocess"},
-  \code{"calculate"} and \code{"printout"}. If not set,
-  their default values are used. See
-  \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}} for
-  details.}
+  \code{"calculate"}, \code{"printout"} and
+  \code{"doPrintout"}. If not set, their default values are
+  used. See \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}}
+  for details.}
 
   \item{rkh}{A named list of options to be forwarded to
   \code{\link[rkwarddev:rk.rkh.doc]{rk.rkh.doc}}, to

Modified: trunk/rkward/packages/rkwarddev/man/rk.plugin.skeleton.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rk.plugin.skeleton.Rd	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/man/rk.plugin.skeleton.Rd	2011-10-22 22:32:15 UTC (rev 3989)
@@ -65,10 +65,10 @@
   because some don't make sense in this context. Valid
   options are: \code{"require"}, \code{"results.header"},
   \code{"variables"}, \code{"preprocess"},
-  \code{"calculate"} and \code{"printout"}. If not set,
-  their default values are used. See
-  \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}} for
-  details.}
+  \code{"calculate"}, \code{"printout"} and
+  \code{"doPrintout"}. If not set, their default values are
+  used. See \code{\link[rkwarddev:rk.JS.doc]{rk.JS.doc}}
+  for details.}
 
   \item{pluginmap}{A named list of options to be forwarded
   to

Modified: trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd	2011-10-22 13:52:25 UTC (rev 3988)
+++ trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd	2011-10-22 22:32:15 UTC (rev 3989)
@@ -8,8 +8,8 @@
 }
 \details{
   \tabular{ll}{ Package: \tab rkwarddev\cr Type: \tab
-  Package\cr Version: \tab 0.04-2\cr Date: \tab
-  2011-10-21\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward
+  Package\cr Version: \tab 0.04-3\cr Date: \tab
+  2011-10-22\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward
   (>= 0.5.7)\cr Enhances: \tab rkward\cr Encoding: \tab
   UTF-8\cr License: \tab GPL (>= 3)\cr LazyLoad: \tab
   yes\cr URL: \tab http://rkward.sourceforge.net\cr }

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list