[rkward-cvs] [rkward] packages/rkwarddev: fixing some issues with child nodes of <snippets> and <tabbook>
m.eik michalke
meik.michalke at uni-duesseldorf.de
Sun Nov 30 22:08:15 UTC 2014
Git commit c26181ddf3ed33c9212004442bb12b78f49fced0 by m.eik michalke.
Committed on 30/11/2014 at 22:07.
Pushed by meikm into branch 'master'.
fixing some issues with child nodes of <snippets> and <tabbook>
M +3 -1 packages/rkwarddev/ChangeLog
M +1 -1 packages/rkwarddev/DESCRIPTION
M +1 -0 packages/rkwarddev/R/rk-internal.R
M +5 -9 packages/rkwarddev/R/rk.XML.snippets.R
M +17 -12 packages/rkwarddev/R/rk.XML.tabbook.R
M +1 -1 packages/rkwarddev/R/rkwarddev-package.R
M +3 -1 packages/rkwarddev/inst/NEWS.Rd
M +- -- packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
M +4 -2 packages/rkwarddev/man/rk.XML.snippets.Rd
M +4 -0 packages/rkwarddev/man/rk.XML.tabbook.Rd
M +1 -1 packages/rkwarddev/man/rkwarddev-package.Rd
http://commits.kde.org/rkward/c26181ddf3ed33c9212004442bb12b78f49fced0
diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog
index be5acdf..1f8e19b 100644
--- a/packages/rkwarddev/ChangeLog
+++ b/packages/rkwarddev/ChangeLog
@@ -1,6 +1,6 @@
ChangeLog for package rkwarddev
-changes in version 0.06-6 (2014-11-28)
+changes in version 0.06-6 (2014-11-30)
fixed:
- rk.XML.optionset() does now allow to re-use objects defined in the same
function call (i.e., refer to optioncolumns in the logic section)
@@ -9,6 +9,8 @@ fixed:
- rk.build.plugin() was still only using the "--no-vignettes" option from R < 3
- rk.XML.pluginmap() malformed label argument names if they referred to standrad maneu entries
- rk.plugin.skeleton() still allowed invalid IDs, fixed the regexp
+ - rk.XML.snippets() now also accepts <include> as child node
+ - rk.XML.tabbook() returns <insert> nodes as-is, not nested in <tab></tab>
added:
- all "help" values can now be a list of character strings or XiMpLe nodes,
to have more control over the markup
diff --git a/packages/rkwarddev/DESCRIPTION b/packages/rkwarddev/DESCRIPTION
index db80f3f..0923ab4 100644
--- a/packages/rkwarddev/DESCRIPTION
+++ b/packages/rkwarddev/DESCRIPTION
@@ -15,7 +15,7 @@ URL: http://rkward.sourceforge.net
Authors at R: c(person(given="Meik", family="Michalke",
email="meik.michalke at hhu.de", role=c("aut", "cre")))
Version: 0.06-6
-Date: 2014-11-28
+Date: 2014-11-30
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 fd1c5c7..5afbcff 100644
--- a/packages/rkwarddev/R/rk-internal.R
+++ b/packages/rkwarddev/R/rk-internal.R
@@ -759,6 +759,7 @@ all.valid.children <- list(
radio=c("option", "!--"),
select=c("option", "!--"),
settings=c("setting", "caption", "!--"),
+ snippets=c("include", "snippet", "!--"),
valueselector=c("option", "!--"),
wizard=c("browser", "checkbox", "column", "copy",
"dropdown", "embed", "formula", "frame", "include", "input", "insert", "matrix",
diff --git a/packages/rkwarddev/R/rk.XML.snippets.R b/packages/rkwarddev/R/rk.XML.snippets.R
index 712e40a..d275c30 100644
--- a/packages/rkwarddev/R/rk.XML.snippets.R
+++ b/packages/rkwarddev/R/rk.XML.snippets.R
@@ -18,14 +18,16 @@
#' Create XML "snippets" node for RKWard plugins
#'
-#' This function will create a snippets node for the document section, with optional child nodes "snippet".
+#' This function will create a snippets node for the document section, with optional child nodes
+#' \code{<snippet>} and \code{<include>}.
#'
-#' @param ... Objects of class \code{XiMpLe.node}. They must all have the name "snippet".
+#' @param ... Objects of class \code{XiMpLe.node}. Accepts only \code{<snippet>} and \code{<include>}.
#' @return An object of class \code{XiMpLe.node}.
#' @export
#' @seealso
#' \code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}}
#' \code{\link[rkwarddev:rk.XML.snippet]{rk.XML.snippet}},
+#' \code{\link[rkwarddev:rk.XML.include]{rk.XML.include}},
#' and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
#' @examples
#' # define a formula section with varselector and varslots
@@ -39,13 +41,7 @@ rk.XML.snippets <- function(...){
nodes <- list(...)
# check the node names and allow only valid ones
- sapply(child.list(nodes), function(this.node){
- stopifnot(is.XiMpLe.node(this.node))
- node.name <- slot(this.node, "name")
- if(!node.name %in% c("snippet", "!--")){
- stop(simpleError(paste0("Invalid XML nodes for snippets section: ", node.name)))
- } else {}
- })
+ valid.child("snippets", children=nodes)
node <- XMLNode("snippets", .children=child.list(nodes, empty=FALSE))
diff --git a/packages/rkwarddev/R/rk.XML.tabbook.R b/packages/rkwarddev/R/rk.XML.tabbook.R
index 34f33dc..22ae8f5 100644
--- a/packages/rkwarddev/R/rk.XML.tabbook.R
+++ b/packages/rkwarddev/R/rk.XML.tabbook.R
@@ -28,6 +28,7 @@
#' 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}.
+#' @note If a node in \code{tabs} is \code{<insert>}, it is returned as-is, without being nested in \code{<tab>}.
#' @return An object of class \code{XiMpLe.node}.
#' @export
#' @seealso
@@ -57,22 +58,26 @@ rk.XML.tabbook <- function(label=NULL, tabs=list(), id.name="auto", i18n=NULL){
tab.ids <- auto.ids(tab.labels, prefix=ID.prefix("tab", length=3))
} else {}
tabs <- sapply(1:num.tabs, function(this.num){
- this.tab <- tab.labels[[this.num]]
- attr.list <- list(label=this.tab)
- if(identical(id.name, "auto")){
- attr.list[["id"]] <- tab.ids[[this.num]]
- } else if(!is.null(id.name)){
- attr.list[["id"]] <- id.name[[this.num + 1]]
- } else {}
- if(!is.null(tabs[[this.num]])){
- child <- tabs[[this.num]]
+ if(is.XiMpLe.node(tabs[[this.num]]) && XMLName(tabs[[this.num]]) %in% c("insert", "tab")){
+ return(tabs[[this.num]])
} else {
- child <- list()
- }
- return(XMLNode("tab",
+ this.tab <- tab.labels[[this.num]]
+ attr.list <- list(label=this.tab)
+ if(identical(id.name, "auto")){
+ attr.list[["id"]] <- tab.ids[[this.num]]
+ } else if(!is.null(id.name)){
+ attr.list[["id"]] <- id.name[[this.num + 1]]
+ } else {}
+ if(!is.null(tabs[[this.num]])){
+ child <- tabs[[this.num]]
+ } else {
+ child <- list()
+ }
+ return(XMLNode("tab",
attrs=attr.list,
.children=child.list(child, empty=FALSE))
)
+ }
})
diff --git a/packages/rkwarddev/R/rkwarddev-package.R b/packages/rkwarddev/R/rkwarddev-package.R
index 471fdca..48a6d7b 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.06-6\cr
-#' Date: \tab 2014-11-28\cr
+#' Date: \tab 2014-11-30\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 abe87cf..ac6502b 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.06-6 (2014-11-28)}{
+\section{Changes in rkwarddev version 0.06-6 (2014-11-30)}{
\subsection{fixed}{
\itemize{
\item \code{rk.XML.optionset()} does now allow to re-use objects defined in the same
@@ -11,6 +11,8 @@
\item \code{rk.build.plugin()} was still only using the "--no-vignettes" option from R < 3
\item \code{rk.XML.pluginmap()} malformed label argument names if they referred to standrad maneu entries
\item \code{rk.plugin.skeleton()} still allowed invalid IDs, fixed the regexp
+ \item \code{rk.XML.snippets()} now also accepts <include> as child node
+ \item \code{rk.XML.tabbook()} returns <insert> nodes as-is, not nested in <tab></tab>
}
}
\subsection{added}{
diff --git a/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf b/packages/rkwarddev/inst/doc/rkwarddev_vignette.pdf
index 3adc32f..e1dcc32 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/rk.XML.snippets.Rd b/packages/rkwarddev/man/rk.XML.snippets.Rd
index 1b86a07..5d8ad23 100644
--- a/packages/rkwarddev/man/rk.XML.snippets.Rd
+++ b/packages/rkwarddev/man/rk.XML.snippets.Rd
@@ -6,14 +6,15 @@
rk.XML.snippets(...)
}
\arguments{
-\item{...}{Objects of class \code{XiMpLe.node}. They must all have the name "snippet".}
+\item{...}{Objects of class \code{XiMpLe.node}. Accepts only \code{<snippet>} and \code{<include>}.}
}
\value{
An object of class \code{XiMpLe.node}.
}
\description{
This function will create a snippets node for the document section,
- with optional child nodes "snippet".
+ with optional child nodes
+\code{<snippet>} and \code{<include>}.
}
\examples{
# define a formula section with varselector and varslots
@@ -26,6 +27,7 @@ cat(pasteXML(test.snippets))
\seealso{
\code{\link[rkwarddev:rk.XML.plugin]{rk.XML.plugin}}
\code{\link[rkwarddev:rk.XML.snippet]{rk.XML.snippet}},
+ \code{\link[rkwarddev:rk.XML.include]{rk.XML.include}},
and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard}
}
diff --git a/packages/rkwarddev/man/rk.XML.tabbook.Rd b/packages/rkwarddev/man/rk.XML.tabbook.Rd
index 759d2bf..a0c75b4 100644
--- a/packages/rkwarddev/man/rk.XML.tabbook.Rd
+++ b/packages/rkwarddev/man/rk.XML.tabbook.Rd
@@ -28,6 +28,10 @@ An object of class \code{XiMpLe.node}.
\description{
Create XML node "tabbook" for RKWard plugins
}
+\note{
+If a node in \code{tabs} is \code{<insert>}, it is returned as-is,
+ without being nested in \code{<tab>}.
+}
\examples{
test.checkboxes <- rk.XML.row(rk.XML.col(
rk.XML.cbox(label="foo", val="foo1", chk=TRUE),
diff --git a/packages/rkwarddev/man/rkwarddev-package.Rd b/packages/rkwarddev/man/rkwarddev-package.Rd
index f45c4fa..edc862d 100644
--- a/packages/rkwarddev/man/rkwarddev-package.Rd
+++ b/packages/rkwarddev/man/rkwarddev-package.Rd
@@ -11,7 +11,7 @@ A collection of tools for RKWard plugin development.
Package: \tab rkwarddev\cr
Type: \tab Package\cr
Version: \tab 0.06-6\cr
-Date: \tab 2014-11-28\cr
+Date: \tab 2014-11-30\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