plugin2script | R Documentation |
These methods try to translate plugin XML objects into rkwarddev
function calls.
plugin2script( obj, prefix = "", indent = TRUE, level = 1, drop.defaults = TRUE, node.names = FALSE, collapse = ".", update = NULL ) ## S4 method for signature 'XiMpLe.doc' plugin2script( obj, prefix = "", indent = TRUE, level = 1, drop.defaults = TRUE, node.names = FALSE, collapse = ".", update = NULL ) ## S4 method for signature 'XiMpLe.node' plugin2script( obj, prefix = "", indent = TRUE, level = 1, drop.defaults = TRUE, node.names = FALSE, collapse = ".", update = NULL ) ## S4 method for signature 'character' plugin2script( obj, prefix = "", indent = TRUE, level = 1, drop.defaults = TRUE, node.names = FALSE, collapse = ".", update = NULL ) ## S4 method for signature 'connection' plugin2script( obj, prefix = "", indent = TRUE, level = 1, drop.defaults = TRUE, node.names = FALSE, collapse = ".", update = NULL )
obj |
Either a character vector (path to a plugin XML file to parse), a connection,
an already
parsed XML tree (class |
prefix |
Character string,
used as the prefix for the object names used in the script. Set to |
indent |
Logical, whether the script code should be indented properly. |
level |
Integer number, the starting leven of indentation. |
drop.defaults |
Logical, whether to check for the default options in function calls. If the parsed and translated XML code resulted in default options, they are omitted in the resulting script. |
node.names |
Logical, whether the node names should become part of the generated R object names. |
collapse |
Character string, used to collapse the parts of the generated R object names. |
update |
A named list, previous result of a |
They are intended to make it easier to translate previously manually maintained plugin code
into rkwarddev
scripts. The generated output should not be used as-is,
but restructured
properly into a useful script.
You can either use a full XML document (read with parseXMLTree
)
or single (also nested) XiMpLe XML nodes. If you provide a character string,
it is assumed to be
the full path to a document to be parsed with parseXMLTree
and then analysed. Connections
are also accepted.
Either a character vector (if obj
is a single XML node)
or a list of character vectors named "logic"
, "dialog"
, "wizard"
,
"summary"
, "usage"
, "settings"
, "related"
,
"technical"
,
"dependencies"
, "dependency_check"
, "about"
, "require"
,
"components"
, and "hierarchy"
(if obj
is a full XML document).
The methods might fail, especially with highly complex plugins. Try to break these into sensible chunks and try those speparately. Sometimes, slightly changing the input file might also do the trick to get some usable results.
## Not run: # full XML documents rkwarddevScript <- plugin2script("~/RKWardPlugins/plugins/myPlugin.xml") rkwarddevScript <- plugin2script("~/RKWardPlugins/plugins/myPlugin.rkh", update=rkwarddevScript) rkwarddevScript <- plugin2script("~/RKWardPlugins/myPlugin.pluginmap", update=rkwarddevScript) sapply(rkwarddevScript, cat) ## End(Not run) # single XML node (test.checkboxes <- rk.XML.row( rk.XML.col( list( rk.XML.cbox(label="foo", value="foo1", chk=TRUE), rk.XML.cbox(label="bar", value="bar2") ) ) )) rkwarddevScript <- plugin2script(test.checkboxes) # see the generated script code cat(rkwarddevScript) # we can evaluate the generated code to check whether original # XML and the newly generated one are identical eval(parse(text=rkwarddevScript)) identical(row_clmndc1212, test.checkboxes)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.