[rkward-cvs] SF.net SVN: rkward:[3856] trunk/rkward/rkward/rbackend/rpackages/rkwarddev

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Wed Sep 28 15:35:46 UTC 2011


Revision: 3856
          http://rkward.svn.sourceforge.net/rkward/?rev=3856&view=rev
Author:   m-eik
Date:     2011-09-28 15:35:45 +0000 (Wed, 28 Sep 2011)
Log Message:
-----------
rkwarddev: added snippet support to plugin functions

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd
    trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-28 15:23:12 UTC (rev 3855)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/ChangeLog	2011-09-28 15:35:45 UTC (rev 3856)
@@ -3,6 +3,7 @@
 ## 0.02-1 (2011-09-28)
   - added functions rk.XML.insert(), rk.XML.include(), rk.XML.embed(), rk.XML.preview(),
     rk.XML.snippet(), and rk.XML.snippets()
+  - added support for snippets section to rk.XML.plugin() and rk.plugin.skeleton()
   - included formula node into rk.XML.vars() wrapper
   - rk.XML.varslot() now automatically sets "multi=TRUE" if "min", "max" or "any" are set
 

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R	2011-09-28 15:23:12 UTC (rev 3855)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.XML.plugin.R	2011-09-28 15:35:45 UTC (rev 3856)
@@ -8,6 +8,8 @@
 #'		\code{\link[rkwarddev:rk.XML.wizard]{rk.XML.wizard}} for details.
 #' @param logic An object of class \code{XiMpLe.node} to be pasted as the \code{<logic>} section. See
 #'		\code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}} for details.
+#' @param snippets An object of class \code{XiMpLe.node} to be pasted as the \code{<snippets>} section. See
+#'		\code{\link[rkwarddev:rk.XML.snippets]{rk.XML.snippets}} for details.
 #' @param provides Character vector with possible entries of \code{"logic"}, \code{"dialog"} or \code{"wizard"}, defining what
 #'		sections the document should provide even if \code{dialog}, \code{wizard} and \code{logic} are \code{NULL}.
 #'		These sections must be edited manually and some parts are therefore commented out.
@@ -33,7 +35,7 @@
 #' test.plugin <- rk.XML.plugin("My test", dialog=test.tabbook)
 #' cat(pasteXMLTree(test.plugin))
 
-rk.XML.plugin <- function(name, dialog=NULL, wizard=NULL, logic=NULL, provides=NULL, help=TRUE, pluginmap=NULL, label=NULL, clean.name=TRUE){
+rk.XML.plugin <- function(name, dialog=NULL, wizard=NULL, logic=NULL, snippets=NULL, provides=NULL, help=TRUE, pluginmap=NULL, label=NULL, clean.name=TRUE){
 	if(isTRUE(clean.name)){
 		name.orig <- name
 		name <- clean.name(name)
@@ -58,6 +60,19 @@
 		)
 	} else {}
 
+	if(!is.null(snippets)){
+		# check if this is *really* a snippets section, otherwise quit and go dancing
+		if(inherits(snippets, "XiMpLe.node")){
+			snippets.node.name <- snippets at name
+		} else {
+			snippets.node.name <- "yougottabekiddingme"
+		}
+		if(!identical(snippets.node.name, "snippets")){
+			stop(simpleError("I don't know what this is, but 'snippets' is not a snippets section!"))
+		} else {}
+		all.children[[length(all.children)+1]] <- snippets
+	} else {}
+
 	if(is.null(logic)){
 		if("logic" %in% provides){
 			lgc.children <- list(

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R	2011-09-28 15:23:12 UTC (rev 3855)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/R/rk.plugin.skeleton.R	2011-09-28 15:35:45 UTC (rev 3856)
@@ -12,6 +12,8 @@
 #'		\code{\link[rkwarddev:rk.XML.wizard]{rk.XML.wizard}} for details.
 #' @param logic An object of class \code{XiMpLe.node} to be pasted as the \code{<logic>} section. See
 #'		\code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}} for details.
+#' @param snippets An object of class \code{XiMpLe.node} to be pasted as the \code{<snippets>} section. See
+#'		\code{\link[rkwarddev:rk.XML.snippets]{rk.XML.snippets}} for details.
 #' @param provides Character vector with possible entries of \code{"logic"}, \code{"dialog"} or \code{"wizard"}, defining what
 #'		sections the document should provide even if \code{dialog}, \code{wizard} and \code{logic} are \code{NULL}.
 #'		These sections must be edited manually and some parts are therefore commented out.
@@ -98,7 +100,7 @@
 #'   dialog=test.tabbook, overwrite=TRUE)
 #' }
 
-rk.plugin.skeleton <- function(name, about=NULL, path=tempdir(), dialog=NULL, wizard=NULL, logic=NULL,
+rk.plugin.skeleton <- function(name, about=NULL, path=tempdir(), dialog=NULL, wizard=NULL, logic=NULL, snippets=NULL,
 	provides=c("logic", "dialog"), dial.require=c(), overwrite=FALSE, tests=TRUE, lazyLoad=TRUE,
 	JS.prep=NULL, JS.calc=NULL, JS.prnt=NULL, create=c("pmap", "xml", "js", "rkh", "desc"), edit=FALSE){
 	# to besure, remove all non-character symbols from name
@@ -174,6 +176,7 @@
 			dialog=dialog,
 			wizard=wizard,
 			logic=logic,
+			snippets=snippets,
 			provides=provides,
 			pluginmap=paste("../", name, ".pluginmap", sep=""))
 		cat(pasteXMLTree(XML.plugin, shine=1), file=plugin.xml)

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd	2011-09-28 15:23:12 UTC (rev 3855)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.XML.plugin.Rd	2011-09-28 15:35:45 UTC (rev 3856)
@@ -3,8 +3,8 @@
 \title{Create XML document for RKWard plugins}
 \usage{
   rk.XML.plugin(name, dialog = NULL, wizard = NULL, logic =
-  NULL, provides = NULL, help = TRUE, pluginmap = NULL,
-  label = NULL, clean.name = TRUE)
+  NULL, snippets = NULL, provides = NULL, help = TRUE,
+  pluginmap = NULL, label = NULL, clean.name = TRUE)
 }
 \arguments{
   \item{name}{Character string, the name of the plugin.
@@ -27,6 +27,11 @@
   \code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}} for
   details.}
 
+  \item{snippets}{An object of class \code{XiMpLe.node} to
+  be pasted as the \code{<snippets>} section. See
+  \code{\link[rkwarddev:rk.XML.snippets]{rk.XML.snippets}}
+  for details.}
+
   \item{provides}{Character vector with possible entries of
   \code{"logic"}, \code{"dialog"} or \code{"wizard"},
   defining what sections the document should provide even

Modified: trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd	2011-09-28 15:23:12 UTC (rev 3855)
+++ trunk/rkward/rkward/rbackend/rpackages/rkwarddev/man/rk.plugin.skeleton.Rd	2011-09-28 15:35:45 UTC (rev 3856)
@@ -3,11 +3,11 @@
 \title{Create skeleton for RKWard plugins}
 \usage{
   rk.plugin.skeleton(name, about = NULL, path = tempdir(),
-  dialog = NULL, wizard = NULL, logic = NULL, provides =
-  c("logic", "dialog"), dial.require = c(), overwrite =
-  FALSE, tests = TRUE, lazyLoad = TRUE, JS.prep = NULL,
-  JS.calc = NULL, JS.prnt = NULL, create = c("pmap", "xml",
-  "js", "rkh", "desc"), edit = FALSE)
+  dialog = NULL, wizard = NULL, logic = NULL, snippets =
+  NULL, provides = c("logic", "dialog"), dial.require =
+  c(), overwrite = FALSE, tests = TRUE, lazyLoad = TRUE,
+  JS.prep = NULL, JS.calc = NULL, JS.prnt = NULL, create =
+  c("pmap", "xml", "js", "rkh", "desc"), edit = FALSE)
 }
 \arguments{
   \item{name}{Character sting, name of the plugin package.}
@@ -37,6 +37,11 @@
   \code{\link[rkwarddev:rk.XML.logic]{rk.XML.logic}} for
   details.}
 
+  \item{snippets}{An object of class \code{XiMpLe.node} to
+  be pasted as the \code{<snippets>} section. See
+  \code{\link[rkwarddev:rk.XML.snippets]{rk.XML.snippets}}
+  for details.}
+
   \item{provides}{Character vector with possible entries of
   \code{"logic"}, \code{"dialog"} or \code{"wizard"},
   defining what sections the document should provide even

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