From: m.eik m. <mei...@un...> - 2015-01-06 20:43:59
|
Git commit 1b1512a24882316608c6c0d0bd33afea78658767 by m.eik michalke. Committed on 06/01/2015 at 20:36. Pushed by meikm into branch 'master'. fix a issue with global JS variables M +3 -0 packages/rkwarddev/ChangeLog M +2 -4 packages/rkwarddev/R/rk.JS.doc.R http://commits.kde.org/rkward/1b1512a24882316608c6c0d0bd33afea78658767 diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog index a761708..b0a91ff 100644 --- a/packages/rkwarddev/ChangeLog +++ b/packages/rkwarddev/ChangeLog @@ -62,6 +62,9 @@ changed: - rk.JS.doc() now uses a more robust method to set global variables, namely by defining an additional function setGlobalVars() and calling that inside preprocess() + - due to changes needed for i18n and rk.JS.header() to work, check your + "result.header" values, there might be quote issues. for the most part, + remove quotes you added for rkwarddev >= 0.05-0 removed: - the functions rk.set.language() rk.get.language() were no longer useful and therefore removed diff --git a/packages/rkwarddev/R/rk.JS.doc.R b/packages/rkwarddev/R/rk.JS.doc.R index 9bbf9d5..127d580 100644 --- a/packages/rkwarddev/R/rk.JS.doc.R +++ b/packages/rkwarddev/R/rk.JS.doc.R @@ -65,14 +65,12 @@ rk.JS.doc <- function(require=c(), variables=NULL, globals=NULL, results.header= addSetGlobalVars <- FALSE # some data transformation - if(all(sapply(variables, function(x){inherits(x, "rk.JS.var")}))){ + if(!is.null(variables) & all(sapply(variables, function(x){inherits(x, "rk.JS.var")}))){ variables <- rk.paste.JS( paste0(unlist(sapply(variables, function(x){rk.paste.JS(x, var=FALSE)}))) ) } else {} - if(inherits(variables, "rk.JS.var")){ - } else {} - if(all(sapply(globals, function(x){inherits(x, "rk.JS.var")}))){ + if(!is.null(globals) & all(sapply(globals, function(x){inherits(x, "rk.JS.var")}))){ globalNames <- paste0("var ", unlist(sapply(globals, function(x){paste.JS.var(x, names.only=TRUE)})), ";", collapse="\n") globalFunction <- paste0( "function setGlobalVars(){\n", |