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

m-eik at users.sourceforge.net m-eik at users.sourceforge.net
Tue Oct 18 12:51:12 UTC 2011


Revision: 3967
          http://rkward.svn.sourceforge.net/rkward/?rev=3967&view=rev
Author:   m-eik
Date:     2011-10-18 12:51:12 +0000 (Tue, 18 Oct 2011)
Log Message:
-----------
rkwarddev: improved format of generated JS code

Modified Paths:
--------------
    trunk/rkward/packages/rkwarddev/R/rk.JS.doc.R
    trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R
    trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf

Modified: trunk/rkward/packages/rkwarddev/R/rk.JS.doc.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.doc.R	2011-10-18 11:31:11 UTC (rev 3966)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.doc.R	2011-10-18 12:51:12 UTC (rev 3967)
@@ -27,20 +27,20 @@
 	preprocess=NULL, calculate=NULL, printout=NULL, indent.by="\t"){
 
 	js.require <- unlist(sapply(require, function(this.req){
-			paste(indent(2, by=indent.by), "echo(\"require(", this.req, ")\\n\");", sep="")
+			paste(indent(2, by=indent.by), "echo(\"require(", this.req, ")\\n\");\n", sep="")
 		}))
 	js.preprocess <- paste("function preprocess(){\n",
-		indent(2, by=indent.by), "// add requirements etc. here.\n",
-		paste(js.require, collapse="\n"), "\n",
-		ifelse(is.null(preprocess), "", preprocess),
-		"\n}", sep="")
+		indent(2, by=indent.by), "// add requirements etc. here\n",
+		paste(js.require, collapse=""),
+		ifelse(is.null(preprocess), "", paste(preprocess, "\n", sep="")),
+		"}", sep="")
 
 	js.calculate <- paste("function calculate(){\n",
 			indent(2, by=indent.by), "// read in variables from dialog\n",
-			paste(variables, collapse=""), "\n",
-			indent(2, by=indent.by), "// put the R code to be evaluated here.\n",
-			ifelse(is.null(calculate), "", calculate),
-			"\n}", sep="")
+			ifelse(is.null(variables), "\n", paste(paste(variables, collapse=""), "\n", sep="")),
+			indent(2, by=indent.by), "// put the R code to be evaluated here\n",
+			ifelse(is.null(calculate), "", paste(calculate, "\n", sep="")),
+			"}", sep="")
 		
 	js.printout <- paste("function printout(){\n",
 				indent(2, by=indent.by), "// printout the results\n",

Modified: trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R	2011-10-18 11:31:11 UTC (rev 3966)
+++ trunk/rkward/packages/rkwarddev/R/rk.plugin.skeleton.R	2011-10-18 12:51:12 UTC (rev 3967)
@@ -235,7 +235,10 @@
 			if("var" %in% scan){
 				var.scanned <- rk.JS.scan(XML.plugin)
 				if(!is.null(var.scanned)){
-					js[["variables"]] <- paste(js[["variables"]], var.scanned, sep="\n")
+					js[["variables"]] <- paste(
+						ifelse(is.null(js[["variables"]]), "", paste(js[["variables"]], "\n", sep="")),
+						var.scanned,
+						sep="")
 				} else {}
 			} else {}
 			if("saveobj" %in% scan){

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

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