[rkward] packages/rkwarddev: added hint to particular rkwarddev scripts in generated code

m.eik michalke meik.michalke at uni-duesseldorf.de
Thu Nov 19 14:49:39 UTC 2015


Git commit 43ae8d5e601b12a157b65b56d019175eae7ff91e by m.eik michalke.
Committed on 19/11/2015 at 14:48.
Pushed by meikm into branch 'master'.

added hint to particular rkwarddev scripts in generated code

  - you can now set 'gen.info' to a character string naming your rkwarddev script file,
    which will be added to all generated files, so people know what file to change
  - also improved the comment pasting in JS code by adding an extra space between the comment indicator and actual text

M  +4    -1    packages/rkwarddev/ChangeLog
M  +6    -5    packages/rkwarddev/DESCRIPTION
M  +13   -2    packages/rkwarddev/R/rk-internal.R
M  +9    -3    packages/rkwarddev/R/rk.JS.doc.R
M  +5    -1    packages/rkwarddev/R/rk.XML.plugin.R
M  +5    -1    packages/rkwarddev/R/rk.XML.pluginmap.R
M  +1    -1    packages/rkwarddev/R/rk.paste.JS.R
M  +2    -0    packages/rkwarddev/R/rk.plugin.component.R
M  +2    -0    packages/rkwarddev/R/rk.plugin.skeleton.R
M  +5    -1    packages/rkwarddev/R/rk.rkh.doc.R
M  +1    -1    packages/rkwarddev/R/rkwarddev-package.R
M  +4    -1    packages/rkwarddev/inst/NEWS.Rd
M  +3    -4    packages/rkwarddev/man/rk.JS.doc.Rd
M  +3    -1    packages/rkwarddev/man/rk.XML.plugin.Rd
M  +3    -1    packages/rkwarddev/man/rk.XML.pluginmap.Rd
M  +3    -1    packages/rkwarddev/man/rk.plugin.component.Rd
M  +3    -1    packages/rkwarddev/man/rk.rkh.doc.Rd
M  +1    -1    packages/rkwarddev/man/rkwarddev-package.Rd

http://commits.kde.org/rkward/43ae8d5e601b12a157b65b56d019175eae7ff91e

diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog
index dcad0f4..9d6a122 100644
--- a/packages/rkwarddev/ChangeLog
+++ b/packages/rkwarddev/ChangeLog
@@ -1,6 +1,6 @@
 ChangeLog for package rkwarddev
 
-changes in version 0.07-4 (2015-11-15)
+changes in version 0.07-4 (2015-11-19)
 unreleased:
   - this version is under development
 fixed:
@@ -14,6 +14,7 @@ fixed:
   - some fixes to the skeleton GUI and demo script
   - prevent internal function indent() from losing it over negative values
   - indentation of rk.paste.JS.graph() was incorrect
+  - pasting comments via rk.paste.JS() gained an extra space for subsequent lines
 added:
   - new methods plugin2script() to try to translate raw plugin XML into
     working rkwarddev script calls
@@ -39,6 +40,8 @@ added:
     "noquote" to have it nested in the JS noquote() function
   - new wrapper function rk.updatePluginMessages() for
     update_plugin_messages.py, the package now comes with its own copy of this core i18n script
+  - the generator info gained support for hinting at the very rkwarddev script file
+    that was used to generate a particular plugin file
 changed:
   - improved error handling in rk.JS.header(), error messages are more
     informative now
diff --git a/packages/rkwarddev/DESCRIPTION b/packages/rkwarddev/DESCRIPTION
index f764cb6..d4cc342 100644
--- a/packages/rkwarddev/DESCRIPTION
+++ b/packages/rkwarddev/DESCRIPTION
@@ -8,16 +8,17 @@ Depends:
 Suggests:
     testthat
 Enhances: rkward
-Description: Provides functions to create plugin skeletons and XML structures
-    for RKWard.
+Description: Provides functions to create plugin skeletons and XML
+    structures for RKWard.
 License: GPL (>= 3)
 Encoding: UTF-8
 LazyLoad: yes
 URL: https://rkward.kde.org
-Authors at R: c(person(given="m.eik", family="michalke", email="meik.michalke at hhu.de", role=c("aut", "cre", "cph")))
+Authors at R: c(person(given="m.eik", family="michalke",
+        email="meik.michalke at hhu.de", role=c("aut", "cre", "cph")))
 Version: 0.07-4
-Date: 2015-11-15
-RoxygenNote: 5.0.0
+Date: 2015-11-19
+RoxygenNote: 5.0.1
 Collate:
     '00_class_01_rk.JS.arr.R'
     '00_class_02_rk.JS.var.R'
diff --git a/packages/rkwarddev/R/rk-internal.R b/packages/rkwarddev/R/rk-internal.R
index 4d440ad..0b6da19 100644
--- a/packages/rkwarddev/R/rk-internal.R
+++ b/packages/rkwarddev/R/rk-internal.R
@@ -33,9 +33,20 @@ if(isTRUE(R_system_version(getRversion()) < 2.15)){
   }
 } else {}
 
+
+## function generator.info()
 # info message
-generator.info <- rk.comment(paste0("this code was generated using the rkwarddev package.\n",
-      "perhaps don't make changes here, but in the rkwarddev script instead!"))
+generator.info <- function(script=NULL){
+  genInfo <- paste0(
+    "this code was generated using the rkwarddev package.\n",
+    "perhaps don't make changes here, but in the rkwarddev script instead!"
+  )
+  if(!is.null(script)){
+    genInfo <- paste0(genInfo, "\n\nlook for a file called: ", script)
+  } else {}
+  return(rk.comment(genInfo))
+} ## end function generator.info()
+
 
 ## function auto.ids()
 auto.ids <- function(identifiers, prefix=NULL, suffix=NULL, chars=8){
diff --git a/packages/rkwarddev/R/rk.JS.doc.R b/packages/rkwarddev/R/rk.JS.doc.R
index 50285dc..4d26609 100644
--- a/packages/rkwarddev/R/rk.JS.doc.R
+++ b/packages/rkwarddev/R/rk.JS.doc.R
@@ -18,8 +18,6 @@
 
 #' Create JavaScript outline from RKWard plugin XML
 #' 
-#' @note The JavaScript
-#'
 #' @param require A character vector with names of R packages that the dialog depends on.
 #' @param variables Either a character string to be included to read in all needed variables from the dialog (see \code{\link{rk.JS.scan}}),
 #'    or a (list of) objects of class \code{rk.JS.var} which will be coerced into character. These variables will be defined in
@@ -44,6 +42,8 @@
 #'    hence suppressing all load messages (except for warnings and errors) of required packages in the output.
 #' @param gen.info Logical, if \code{TRUE} a comment note will be written into the document,
 #'    that it was generated by \code{rkwarddev} and changes should be done to the script.
+#'    You can also provide a character string naming the very rkwarddev script file that generates this JS file,
+#'    which will then also be added to the comment.
 #' @param indent.by A character string defining how indentation should be done.
 #' @param guess.getter Locigal, if \code{TRUE} try to get a good default getter function for JavaScript
 #'    variable values. Only used if \code{header.add} contains XiMpLe nodes.
@@ -85,7 +85,13 @@ rk.JS.doc <- function(require=c(), variables=NULL, globals=NULL, results.header=
     addSetGlobalVars <- TRUE
   } else {}
 
-  js.gen.info <- ifelse(isTRUE(gen.info), rk.paste.JS(generator.info, level=1), "")
+  if(isTRUE(gen.info)){
+    js.gen.info <- rk.paste.JS(generator.info(), level=1)
+  } else if(is.character(gen.info)){
+    js.gen.info <- rk.paste.JS(generator.info(script=gen.info), level=1)
+  } else {
+    js.gen.info <- ""
+  }
 
   if(!is.null(globals)){
     js.globals <- paste0(
diff --git a/packages/rkwarddev/R/rk.XML.plugin.R b/packages/rkwarddev/R/rk.XML.plugin.R
index 175e99e..e6319d8 100644
--- a/packages/rkwarddev/R/rk.XML.plugin.R
+++ b/packages/rkwarddev/R/rk.XML.plugin.R
@@ -44,6 +44,8 @@
 #'    This is only useful for information that differs from the \code{<dependencies>} section of the \code{.pluginmap} file.
 #' @param gen.info Logical, if \code{TRUE} a comment note will be written into the document,
 #'    that it was generated by \code{rkwarddev} and changes should be done to the script.
+#'    You can also provide a character string naming the very rkwarddev script file that generates this plugin,
+#'    which will then also be added to the comment.
 #' @param i18n Either a character string or a named list with the optional elements \code{context}
 #'    or \code{comment}, to give some \code{i18n_context} information for this node. If set to \code{FALSE},
 #'    the attribute \code{label} will be renamed into \code{noi18n_label}.
@@ -76,7 +78,9 @@ rk.XML.plugin <- function(name, dialog=NULL, wizard=NULL, logic=NULL, snippets=N
   all.children <- list()
 
   if(isTRUE(gen.info)){
-    all.children[[length(all.children)+1]] <- generator.info
+    all.children[[length(all.children)+1]] <- generator.info()
+  } else if(is.character(gen.info)){
+    all.children[[length(all.children)+1]] <- generator.info(script=gen.info)
   } else {}
 
   all.children[[length(all.children)+1]] <- rk.XML.code(file=paste0(name, ".js"))
diff --git a/packages/rkwarddev/R/rk.XML.pluginmap.R b/packages/rkwarddev/R/rk.XML.pluginmap.R
index f5feaad..6054b57 100644
--- a/packages/rkwarddev/R/rk.XML.pluginmap.R
+++ b/packages/rkwarddev/R/rk.XML.pluginmap.R
@@ -43,6 +43,8 @@
 #' @param hints Logical, if \code{TRUE} and you leave out optional entries (like \code{about=NULL}), dummy sections will be added as comments.
 #' @param gen.info Logical, if \code{TRUE} a comment note will be written into the document,
 #'    that it was generated by \code{rkwarddev} and changes should be done to the script.
+#'    You can also provide a character string naming the very rkwarddev script file that generates this pluginmap,
+#'    which will then also be added to the comment.
 #' @param dependencies An object of class \code{XiMpLe.node} to be pasted as the \code{<dependencies>} section,
 #'    See \code{\link[rkwarddev:rk.XML.dependencies]{rk.XML.dependencies}} for details. Skipped if \code{NULL}.
 #' @param namespace Character string, the namespace attribute of the \code{<document>} node, defaults to the plugin name (which you probably shouldn't touch...).
@@ -91,7 +93,9 @@ rk.XML.pluginmap <- function(name, about=NULL, components, hierarchy="test",
   all.children <- list()
 
   if(isTRUE(gen.info)){
-    all.children[[length(all.children)+1]] <- generator.info
+    all.children[[length(all.children)+1]] <- generator.info()
+  } else if(is.character(gen.info)){
+    all.children[[length(all.children)+1]] <- generator.info(script=gen.info)
   } else {}
 
   # check about and dependencies
diff --git a/packages/rkwarddev/R/rk.paste.JS.R b/packages/rkwarddev/R/rk.paste.JS.R
index 6308312..1c9ab29 100644
--- a/packages/rkwarddev/R/rk.paste.JS.R
+++ b/packages/rkwarddev/R/rk.paste.JS.R
@@ -97,7 +97,7 @@ rk.paste.JS <- function(..., level=2, indent.by=rk.get.indent(), funct=NULL, arr
       if(identical(XMLName(this.object), "!--")){
         result <- paste0(indent(level, by=indent.by),
           "// ",
-          gsub("\n", paste0("\n", indent(level, by=indent.by), "//"), XMLValue(XMLChildren(this.object)[[1]])))
+          gsub("\n", paste0("\n", indent(level, by=indent.by), "// "), XMLValue(XMLChildren(this.object)[[1]])))
       } else {
         stop(simpleError("XiMpLe.node objects are only valid if they are comments!"))
       }
diff --git a/packages/rkwarddev/R/rk.plugin.component.R b/packages/rkwarddev/R/rk.plugin.component.R
index b7ed9be..6fade9f 100644
--- a/packages/rkwarddev/R/rk.plugin.component.R
+++ b/packages/rkwarddev/R/rk.plugin.component.R
@@ -67,6 +67,8 @@
 #'    }
 #' @param gen.info Logical, if \code{TRUE} comment notes will be written into the genrated documents,
 #'    that they were generated by \code{rkwarddev} and changes should be done to the script.
+#'    You can also provide a character string naming the very rkwarddev script file that generates this component,
+#'    which will then also be added to the comment.
 #' @param indent.by A character string defining the indentation string to use.
 #' @return An object of class \code{rk.plug.comp}.
 #' @seealso \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
diff --git a/packages/rkwarddev/R/rk.plugin.skeleton.R b/packages/rkwarddev/R/rk.plugin.skeleton.R
index 75c56f8..aee4718 100644
--- a/packages/rkwarddev/R/rk.plugin.skeleton.R
+++ b/packages/rkwarddev/R/rk.plugin.skeleton.R
@@ -88,6 +88,8 @@
 #'    it was loaded (i.e., this implies and also sets \code{load=TRUE}). This will only work on the main component, though.
 #' @param gen.info Logical, if \code{TRUE} comment notes will be written into the genrated documents,
 #'    that they were generated by \code{rkwarddev} and changes should be done to the script.
+#'    You can also provide a character string naming the very rkwarddev script file that generates this plugin and its main component,
+#'    which will then also be added to the comment.
 #' @param hints Logical, if \code{TRUE} and you leave out optional entries (like \code{dependencies=NULL}), dummy sections will be added as comments.
 #' @param indent.by A character string defining the indentation string to use.
 #' @param internal Logical, a simple switch to build an internal plugin for official distribution with RKWard. If set to \code{TRUE}:
diff --git a/packages/rkwarddev/R/rk.rkh.doc.R b/packages/rkwarddev/R/rk.rkh.doc.R
index 5ed2e64..f76bc94 100644
--- a/packages/rkwarddev/R/rk.rkh.doc.R
+++ b/packages/rkwarddev/R/rk.rkh.doc.R
@@ -36,6 +36,8 @@
 #' @param hints Logical, if \code{TRUE} and you leave out optional entries (like \code{technical=NULL}), empty dummy sections will be added.
 #' @param gen.info Logical, if \code{TRUE} a comment note will be written into the document,
 #'    that it was generated by \code{rkwarddev} and changes should be done to the script.
+#'    You can also provide a character string naming the very rkwarddev script file that generates this help file,
+#'    which will then also be added to the comment.
 #' @return An object of class \code{XiMpLe.doc}.
 #' @seealso
 #'    \code{\link[rkwarddev:rk.rkh.summary]{rk.rkh.summary}},
@@ -52,7 +54,9 @@ rk.rkh.doc <- function(summary=NULL, usage=NULL, sections=NULL, settings=NULL, r
   all.children <- list()
 
   if(isTRUE(gen.info)){
-    all.children[[length(all.children)+1]] <- generator.info
+    all.children[[length(all.children)+1]] <- generator.info()
+  } else if(is.character(gen.info)){
+    all.children[[length(all.children)+1]] <- generator.info(script=gen.info)
   } else {}
 
   if(!is.null(title)){
diff --git a/packages/rkwarddev/R/rkwarddev-package.R b/packages/rkwarddev/R/rkwarddev-package.R
index c3b6e07..0f08724 100644
--- a/packages/rkwarddev/R/rkwarddev-package.R
+++ b/packages/rkwarddev/R/rkwarddev-package.R
@@ -4,7 +4,7 @@
 #' Package: \tab rkwarddev\cr
 #' Type: \tab Package\cr
 #' Version: \tab 0.07-4\cr
-#' Date: \tab 2015-11-15\cr
+#' Date: \tab 2015-11-19\cr
 #' Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-21),rkward (>= 0.5.7)\cr
 #' Enhances: \tab rkward\cr
 #' Encoding: \tab UTF-8\cr
diff --git a/packages/rkwarddev/inst/NEWS.Rd b/packages/rkwarddev/inst/NEWS.Rd
index 1d1a44e..47eb8dc 100644
--- a/packages/rkwarddev/inst/NEWS.Rd
+++ b/packages/rkwarddev/inst/NEWS.Rd
@@ -1,7 +1,7 @@
 \name{NEWS}
 \title{News for Package 'rkwarddev'}
 \encoding{UTF-8}
-\section{Changes in rkwarddev version 0.07-4 (2015-11-15)}{
+\section{Changes in rkwarddev version 0.07-4 (2015-11-19)}{
   \subsection{unreleased}{
     \itemize{
       \item this version is under development
@@ -19,6 +19,7 @@
       \item some fixes to the skeleton GUI and demo script
       \item prevent internal function \code{indent()} from losing it over negative values
       \item indentation of \code{rk.paste.JS.graph()} was incorrect
+      \item pasting comments via \code{rk.paste.JS()} gained an extra space for subsequent lines
     }
   }
   \subsection{added}{
@@ -47,6 +48,8 @@
         \code{"noquote"} to have it nested in the JS \code{noquote()} function
       \item new wrapper function \code{rk.updatePluginMessages()} for
         update_plugin_messages.py, the package now comes with its own copy of this core i18n script
+      \item the generator info gained support for hinting at the very rkwarddev script file
+        that was used to generate a particular plugin file
     }
   }
   \subsection{changed}{
diff --git a/packages/rkwarddev/man/rk.JS.doc.Rd b/packages/rkwarddev/man/rk.JS.doc.Rd
index b741f29..7d6b363 100644
--- a/packages/rkwarddev/man/rk.JS.doc.Rd
+++ b/packages/rkwarddev/man/rk.JS.doc.Rd
@@ -49,7 +49,9 @@ This defines a switch you can add to your plugin,
 hence suppressing all load messages (except for warnings and errors) of required packages in the output.}
 
 \item{gen.info}{Logical, if \code{TRUE} a comment note will be written into the document,
-that it was generated by \code{rkwarddev} and changes should be done to the script.}
+that it was generated by \code{rkwarddev} and changes should be done to the script.
+You can also provide a character string naming the very rkwarddev script file that generates this JS file,
+which will then also be added to the comment.}
 
 \item{indent.by}{A character string defining how indentation should be done.}
 
@@ -63,9 +65,6 @@ A character string.
 \description{
 Create JavaScript outline from RKWard plugin XML
 }
-\note{
-The JavaScript
-}
 \seealso{
 \code{\link[rkwarddev:rk.paste.JS]{rk.paste.JS}},
    \code{\link[rkwarddev:rk.JS.vars]{rk.JS.vars}},
diff --git a/packages/rkwarddev/man/rk.XML.plugin.Rd b/packages/rkwarddev/man/rk.XML.plugin.Rd
index 366e791..c88b6e8 100644
--- a/packages/rkwarddev/man/rk.XML.plugin.Rd
+++ b/packages/rkwarddev/man/rk.XML.plugin.Rd
@@ -54,7 +54,9 @@ See \code{\link[rkwarddev:rk.XML.dependencies]{rk.XML.dependencies}} for details
 This is only useful for information that differs from the \code{<dependencies>} section of the \code{.pluginmap} file.}
 
 \item{gen.info}{Logical, if \code{TRUE} a comment note will be written into the document,
-that it was generated by \code{rkwarddev} and changes should be done to the script.}
+that it was generated by \code{rkwarddev} and changes should be done to the script.
+You can also provide a character string naming the very rkwarddev script file that generates this plugin,
+which will then also be added to the comment.}
 
 \item{i18n}{Either a character string or a named list with the optional elements \code{context}
 or \code{comment},
diff --git a/packages/rkwarddev/man/rk.XML.pluginmap.Rd b/packages/rkwarddev/man/rk.XML.pluginmap.Rd
index 23a7bf7..6e1c643 100644
--- a/packages/rkwarddev/man/rk.XML.pluginmap.Rd
+++ b/packages/rkwarddev/man/rk.XML.pluginmap.Rd
@@ -53,7 +53,9 @@ one .pluginmap filename to be included in this one.}
       if \code{TRUE} and you leave out optional entries (like \code{about=NULL}), dummy sections will be added as comments.}
 
 \item{gen.info}{Logical, if \code{TRUE} a comment note will be written into the document,
-that it was generated by \code{rkwarddev} and changes should be done to the script.}
+that it was generated by \code{rkwarddev} and changes should be done to the script.
+You can also provide a character string naming the very rkwarddev script file that generates this pluginmap,
+which will then also be added to the comment.}
 
 \item{dependencies}{An object of class \code{XiMpLe.node} to be pasted as the \code{<dependencies>} section,
 See \code{\link[rkwarddev:rk.XML.dependencies]{rk.XML.dependencies}} for details. Skipped if \code{NULL}.}
diff --git a/packages/rkwarddev/man/rk.plugin.component.Rd b/packages/rkwarddev/man/rk.plugin.component.Rd
index a981ab4..ffd16d0 100644
--- a/packages/rkwarddev/man/rk.plugin.component.Rd
+++ b/packages/rkwarddev/man/rk.plugin.component.Rd
@@ -95,7 +95,9 @@ This is only useful for information that differs from the \code{<dependencies>}
 
 \item{gen.info}{Logical,
       if \code{TRUE} comment notes will be written into the genrated documents,
-that they were generated by \code{rkwarddev} and changes should be done to the script.}
+that they were generated by \code{rkwarddev} and changes should be done to the script.
+You can also provide a character string naming the very rkwarddev script file that generates this component,
+which will then also be added to the comment.}
 
 \item{indent.by}{A character string defining the indentation string to use.}
 }
diff --git a/packages/rkwarddev/man/rk.rkh.doc.Rd b/packages/rkwarddev/man/rk.rkh.doc.Rd
index 8cb6327..b8eed29 100644
--- a/packages/rkwarddev/man/rk.rkh.doc.Rd
+++ b/packages/rkwarddev/man/rk.rkh.doc.Rd
@@ -35,7 +35,9 @@ Refer to \code{\link{rk.rkh.scan}} for a function to create this from an existin
       if \code{TRUE} and you leave out optional entries (like \code{technical=NULL}), empty dummy sections will be added.}
 
 \item{gen.info}{Logical, if \code{TRUE} a comment note will be written into the document,
-that it was generated by \code{rkwarddev} and changes should be done to the script.}
+that it was generated by \code{rkwarddev} and changes should be done to the script.
+You can also provide a character string naming the very rkwarddev script file that generates this help file,
+which will then also be added to the comment.}
 }
 \value{
 An object of class \code{XiMpLe.doc}.
diff --git a/packages/rkwarddev/man/rkwarddev-package.Rd b/packages/rkwarddev/man/rkwarddev-package.Rd
index 635c81d..49f3945 100644
--- a/packages/rkwarddev/man/rkwarddev-package.Rd
+++ b/packages/rkwarddev/man/rkwarddev-package.Rd
@@ -12,7 +12,7 @@ A Collection of Tools for RKWard Plugin Development.
 Package: \tab rkwarddev\cr
 Type: \tab Package\cr
 Version: \tab 0.07-4\cr
-Date: \tab 2015-11-15\cr
+Date: \tab 2015-11-19\cr
 Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-21),rkward (>= 0.5.7)\cr
 Enhances: \tab rkward\cr
 Encoding: \tab UTF-8\cr



More information about the rkward-tracker mailing list