[rkward] packages/rkwarddev: added ignore option to rk.uniqueIDs()

m.eik michalke meik.michalke at uni-duesseldorf.de
Thu Oct 8 19:59:00 UTC 2015


Git commit e3f8d50863c94bda6dcf7e8163467f08b3e1c23f by m.eik michalke.
Committed on 08/10/2015 at 19:57.
Pushed by meikm into branch 'master'.

added ignore option to rk.uniqueIDs()

  - some nodes (like <copy>) need to duplicate IDs, so they should not cause an error

M  +3    -0    packages/rkwarddev/ChangeLog
M  +3    -4    packages/rkwarddev/DESCRIPTION
M  +5    -1    packages/rkwarddev/R/rk.uniqueIDs.R
M  +3    -0    packages/rkwarddev/inst/NEWS.Rd
M  +-    --    packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
M  +2    -2    packages/rkwarddev/man/XiMpLe-methods.Rd
M  +4    -1    packages/rkwarddev/man/rk.uniqueIDs.Rd

http://commits.kde.org/rkward/e3f8d50863c94bda6dcf7e8163467f08b3e1c23f

diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog
index 47a35c0..e23ed57 100644
--- a/packages/rkwarddev/ChangeLog
+++ b/packages/rkwarddev/ChangeLog
@@ -9,9 +9,12 @@ fixed:
     wasn't a XiMpLe node
   - also fixed how rk.XML.convert() and rk.XML.switch() were handling
     modifier checking
+  - some fixes to the skeleton GUI and demo script
 added:
   - new methods plugin2script() to try to translate raw plugin XML into
     working rkwarddev script calls
+  - new option "ignore" enables rk.uniqueIDs() to not check nodes for
+    duplicates (e.g., <copy>)
 
 changes in version 0.07-3 (2015-06-29)
 fixed:
diff --git a/packages/rkwarddev/DESCRIPTION b/packages/rkwarddev/DESCRIPTION
index a4b8ec7..80c4011 100644
--- a/packages/rkwarddev/DESCRIPTION
+++ b/packages/rkwarddev/DESCRIPTION
@@ -8,14 +8,13 @@ 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")))
+Authors at R: c(person(given="m.eik", family="michalke", email="meik.michalke at hhu.de", role=c("aut", "cre")))
 Version: 0.07-4
 Date: 2015-10-08
 Collate:
diff --git a/packages/rkwarddev/R/rk.uniqueIDs.R b/packages/rkwarddev/R/rk.uniqueIDs.R
index 416dc15..616de73 100644
--- a/packages/rkwarddev/R/rk.uniqueIDs.R
+++ b/packages/rkwarddev/R/rk.uniqueIDs.R
@@ -26,11 +26,15 @@
 #' @param bool Logical, if \code{TRUE} this function will return a logical value.
 #' @param warning Logical, if \code{TRUE} will throw a warning if duplicates were found,
 #'    listing the findings.
+#' @param ignore Character vector, node names that should generally be ignored because
+#'    they duplicate IDs by design.
 #' @return A vector with duplicate IDs, if any were found.
 #'    If \code{bool=TRUE} returns a logical value.
 
-rk.uniqueIDs <- function(obj, bool=FALSE, warning=TRUE){
+rk.uniqueIDs <- function(obj, bool=FALSE, warning=TRUE, ignore=c("copy")){
   allIDs <- XMLScanDeep(obj, find="id", search="attributes")
+  # ignore nodes
+  allIDs <- allIDs[!names(allIDs) %in% ignore]
   duplicateIDs <- duplicated(allIDs)
   if(any(duplicateIDs)){
     # ok, let's get 'em
diff --git a/packages/rkwarddev/inst/NEWS.Rd b/packages/rkwarddev/inst/NEWS.Rd
index bce56d0..e2d2d7f 100644
--- a/packages/rkwarddev/inst/NEWS.Rd
+++ b/packages/rkwarddev/inst/NEWS.Rd
@@ -14,12 +14,15 @@
         wasn't a XiMpLe node
       \item also fixed how \code{rk.XML.convert()} and \code{rk.XML.switch()} were handling
         modifier checking
+      \item some fixes to the skeleton GUI and demo script
     }
   }
   \subsection{added}{
     \itemize{
       \item new methods \code{plugin2script()} to try to translate raw plugin XML into
         working rkwarddev script calls
+      \item new option \code{"ignore"} enables \code{rk.uniqueIDs()} to not check nodes for
+        duplicates (e.g., <copy>)
     }
   }
 }
diff --git a/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf b/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
index d60fe17..bd8f2ab 100644
Binary files a/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf and b/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf differ
diff --git a/packages/rkwarddev/man/XiMpLe-methods.Rd b/packages/rkwarddev/man/XiMpLe-methods.Rd
index 5491842..36c4395 100644
--- a/packages/rkwarddev/man/XiMpLe-methods.Rd
+++ b/packages/rkwarddev/man/XiMpLe-methods.Rd
@@ -26,8 +26,8 @@ parsed XML tree (class \code{XiMpLe.doc}) or a single \code{XiMpLe.node} object.
 }
 \value{
 Either a character vector (if \code{obj} is a single XML node)
-   or a list of character vectors named \code{"logic"},
-      \code{"dialog"} and \code{"wizard"}
+   or a list of character vectors named \code{"logic"}, \code{"dialog"},
+      and \code{"wizard"},
    (if \code{obj} is a full XML document).
 }
 \description{
diff --git a/packages/rkwarddev/man/rk.uniqueIDs.Rd b/packages/rkwarddev/man/rk.uniqueIDs.Rd
index b55646b..1413c67 100644
--- a/packages/rkwarddev/man/rk.uniqueIDs.Rd
+++ b/packages/rkwarddev/man/rk.uniqueIDs.Rd
@@ -4,7 +4,7 @@
 \alias{rk.uniqueIDs}
 \title{Check plugin dialogs for duplicate IDs}
 \usage{
-rk.uniqueIDs(obj, bool = FALSE, warning = TRUE)
+rk.uniqueIDs(obj, bool = FALSE, warning = TRUE, ignore = c("copy"))
 }
 \arguments{
 \item{obj}{An XML object of class XiMpLe.node or XiMpLe.doc.}
@@ -13,6 +13,9 @@ rk.uniqueIDs(obj, bool = FALSE, warning = TRUE)
 
 \item{warning}{Logical, if \code{TRUE} will throw a warning if duplicates were found,
 listing the findings.}
+
+\item{ignore}{Character vector, node names that should generally be ignored because
+they duplicate IDs by design.}
 }
 \value{
 A vector with duplicate IDs, if any were found.



More information about the rkward-tracker mailing list