[rkward-cvs] SF.net SVN: rkward:[4093] trunk/rkward/packages/rkwarddev
m-eik at users.sourceforge.net
m-eik at users.sourceforge.net
Sat Dec 10 23:12:41 UTC 2011
Revision: 4093
http://rkward.svn.sourceforge.net/rkward/?rev=4093&view=rev
Author: m-eik
Date: 2011-12-10 23:12:41 +0000 (Sat, 10 Dec 2011)
Log Message:
-----------
rkwarddev: the produced JavaScript code looks even better now :-)
Modified Paths:
--------------
trunk/rkward/packages/rkwarddev/ChangeLog
trunk/rkward/packages/rkwarddev/DESCRIPTION
trunk/rkward/packages/rkwarddev/R/rk-internal.R
trunk/rkward/packages/rkwarddev/R/rk.JS.saveobj.R
trunk/rkward/packages/rkwarddev/R/rk.JS.scan.R
trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R
trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd
Modified: trunk/rkward/packages/rkwarddev/ChangeLog
===================================================================
--- trunk/rkward/packages/rkwarddev/ChangeLog 2011-12-10 21:08:50 UTC (rev 4092)
+++ trunk/rkward/packages/rkwarddev/ChangeLog 2011-12-10 23:12:41 UTC (rev 4093)
@@ -2,6 +2,7 @@
## 0.04-11 (2011-12-10)
- ite() now supports full recursion also for the "thenjs" option.
+ - fixed superfluous first newline in rk.JS.vars()
## 0.04-10 (2011-12-05)
- when using rk.comment() for logic scripting, its contents will automatically be placed inside a <script> node now
Modified: trunk/rkward/packages/rkwarddev/DESCRIPTION
===================================================================
--- trunk/rkward/packages/rkwarddev/DESCRIPTION 2011-12-10 21:08:50 UTC (rev 4092)
+++ trunk/rkward/packages/rkwarddev/DESCRIPTION 2011-12-10 23:12:41 UTC (rev 4093)
@@ -15,7 +15,7 @@
Authors at R: c(person(given="Meik", family="Michalke",
email="meik.michalke at hhu.de", role=c("aut", "cre")))
Version: 0.04-11
-Date: 2011-12-10
+Date: 2011-12-11
Collate:
'echo.R'
'id.R'
Modified: trunk/rkward/packages/rkwarddev/R/rk-internal.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk-internal.R 2011-12-10 21:08:50 UTC (rev 4092)
+++ trunk/rkward/packages/rkwarddev/R/rk-internal.R 2011-12-10 23:12:41 UTC (rev 4093)
@@ -541,7 +541,9 @@
}
if(nchar(object at thenJS) > 0) {
- thenJS <- paste(scnd.indent, object at thenJS, "\n", main.indent, "}", sep="")
+ # chop off beginning indent strings, otherwiese they ruin the code layout
+ thenJS.clean <- gsub(paste("^", indent.by, "*", sep=""), "", object at thenJS)
+ thenJS <- paste(scnd.indent, thenJS.clean, "\n", main.indent, "}", sep="")
} else {
# if there is another rk.JS.ite object, call with recursion
if(length(object at thenifJS) == 1){
@@ -550,7 +552,9 @@
}
if(nchar(object at elseJS) > 0) {
- elseJS <- paste(" else {\n", scnd.indent, object at elseJS, "\n", main.indent, "}", sep="")
+ # chop off beginning indent strings, otherwiese they ruin the code layout
+ elseJS.clean <- gsub(paste("^", indent.by, "*", sep=""), "", object at elseJS)
+ elseJS <- paste(" else {\n", scnd.indent, elseJS.clean, "\n", main.indent, "}", sep="")
} else {
# if there is another rk.JS.ite object, call with recursion
if(length(object at elifJS) == 1){
@@ -753,8 +757,7 @@
# check modifiers
modifiers <- modifiers[modif.validity(source="all", modifier=modifiers, ignore.empty=TRUE, warn.only=TRUE, bool=TRUE)]
} else {}
- results <- c(results,
- sapply(modifiers, function(this.modif){
+ modif.results <- sapply(modifiers, function(this.modif){
if(isTRUE(names.only)){
return(camelCode(c(JS.prefix, JS.var, this.modif)))
} else {
@@ -762,7 +765,11 @@
" = getValue(\"", XML.var, ".", this.modif, "\")", join.code, ";", sep=""))
}
})
- )
+ if(!identical(results, "")){
+ results <- c(results, modif.results)
+ } else {
+ results <- modif.results
+ }
}
} else {}
Modified: trunk/rkward/packages/rkwarddev/R/rk.JS.saveobj.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.saveobj.R 2011-12-10 21:08:50 UTC (rev 4092)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.saveobj.R 2011-12-10 23:12:41 UTC (rev 4093)
@@ -17,6 +17,8 @@
single.tags <- get.single.tags(XML.obj=pXML, drop=c("comments","cdata", "declarations", "doctype"))
+ main.indent <- indent(2, by=indent.by)
+
# filter for relevant tags
cleaned.tags <- list()
for(this.tag in child.list(single.tags)){
@@ -57,9 +59,12 @@
level=2,
indent.by=indent.by))
})), collapse="")
+ # clean up: remove empty elements
+ JS.vars <- JS.vars[!grepl("^[[:space:]]*$", JS.vars)]
} else {
JS.vars <- NULL
}
+
JS.assign <- paste(unlist(sapply(1:num.tags, function(this.tagnum){
this.tag <- cleaned.tags[this.tagnum]
JS.id <- get.IDs(single.tags=this.tag, relevant.tags="saveobject", add.abbrev=add.abbrev)
@@ -96,7 +101,10 @@
# echo("assign(\""+saveFreqName+"\", REPLACE.ME.obj, envir="+saveFreqEnv+")\n");
# }
- results <- paste(JS.vars, "\n", JS.assign, sep="")
+ results <- paste(main.indent, "//// save result object\n",
+ if(!is.null(JS.vars)) {
+ paste(main.indent, "// read in saveobject variables\n", JS.vars, "\n", sep="")
+ } else {}, main.indent, "// assign object to chosen environment\n", JS.assign, sep="")
return(results)
}
Modified: trunk/rkward/packages/rkwarddev/R/rk.JS.scan.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.JS.scan.R 2011-12-10 21:08:50 UTC (rev 4092)
+++ trunk/rkward/packages/rkwarddev/R/rk.JS.scan.R 2011-12-10 23:12:41 UTC (rev 4093)
@@ -45,13 +45,13 @@
JS.special.id <- get.IDs(single.tags=single.tags, relevant.tags=JS.special.tags, add.abbrev=add.abbrev, only.checkable=TRUE)
if("id" %in% colnames(JS.special.id)){
if(isTRUE(js)){
- JS.lines <- paste(JS.lines, paste(unlist(sapply(1:nrow(JS.special.id), function(this.id){
+ JS.lines <- paste(JS.lines, "\n", paste(unlist(sapply(1:nrow(JS.special.id), function(this.id){
return(rk.paste.JS(get.JS.vars(
JS.var=JS.special.id[this.id,"abbrev"],
XML.var=JS.special.id[this.id,"id"],
modifiers="checked"),
level=2, indent.by=indent.by))
- })), collapse=""))
+ })), collapse="\n"), sep="")
} else {
JS.lines <- c(JS.lines, JS.special.id[,"id"])
names(JS.lines) <- NULL
Modified: trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R 2011-12-10 21:08:50 UTC (rev 4092)
+++ trunk/rkward/packages/rkwarddev/R/rk.paste.JS.R 2011-12-10 23:12:41 UTC (rev 4093)
@@ -58,6 +58,8 @@
stop(simpleError("XiMpLe.node objects are only valid if they are comments!"))
}
} else {
+ # chop off beginning indent strings, otherwiese they ruin the code layout
+ this.object <- gsub(paste("^", indent.by, "*", sep=""), "", this.object)
result <- paste(indent(level, by=indent.by), this.object, sep="")
}
return(result)
Modified: trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R
===================================================================
--- trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R 2011-12-10 21:08:50 UTC (rev 4092)
+++ trunk/rkward/packages/rkwarddev/R/rkwarddev-package.R 2011-12-10 23:12:41 UTC (rev 4093)
@@ -4,7 +4,7 @@
#' Package: \tab rkwarddev\cr
#' Type: \tab Package\cr
#' Version: \tab 0.04-11\cr
-#' Date: \tab 2011-12-10\cr
+#' Date: \tab 2011-12-11\cr
#' Depends: \tab R (>= 2.9.0),XiMpLe,rkward (>= 0.5.6)\cr
#' Enhances: \tab rkward\cr
#' Encoding: \tab UTF-8\cr
Modified: trunk/rkward/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
===================================================================
(Binary files differ)
Modified: trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd
===================================================================
--- trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd 2011-12-10 21:08:50 UTC (rev 4092)
+++ trunk/rkward/packages/rkwarddev/man/rkwarddev-package.Rd 2011-12-10 23:12:41 UTC (rev 4093)
@@ -12,7 +12,7 @@
\details{
\tabular{ll}{ Package: \tab rkwarddev\cr Type: \tab
Package\cr Version: \tab 0.04-11\cr Date: \tab
- 2011-12-10\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward
+ 2011-12-11\cr Depends: \tab R (>= 2.9.0),XiMpLe,rkward
(>= 0.5.6)\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