id: Replace XiMpLe.node objects with their ID value

View source: R/id.R

idR Documentation

Replace XiMpLe.node objects with their ID value

Description

This function is intended to be used for generating JavaScript code for RKWard plugins. Its sole purpose is to replace objects of class XiMpLe.node which hold an XML node of some plugin GUI definition, and objects of classes rk.JS.arr, rk.JS.opt or rk.JS.var with their ID (or JS variable name), and combine these replacements with character strings.

Usage

id(
  ...,
  quote = FALSE,
  collapse = "",
  js = TRUE,
  guess.modifier = TRUE,
  .objects = list(...)
)

Arguments

...

One or several character strings and/or XiMpLe.node objects with plugin nodes, and/or objects of classes rk.JS.arr, rk.JS.opt or rk.JS.var, simply separated by comma.

quote

Logical, if the character strings should be deparsed, so they come out "as-is" when written to files, e.g. by cat.

collapse

Character string, defining if and how the individual elements should be glued together.

js

Logical, if TRUE returns JavaScript varaible names for XiMpLe.node objects. Otherwise their actual ID is returned.

guess.modifier

Logical, if TRUE will append the "checked" modifier to <frame> nodes, but only if js=TRUE as well.

.objects

Alternative way of specifying objects, if you already have them as a list.

Value

A character string.

See Also

rk.JS.vars, rk.JS.array, rk.JS.options, echo, qp (a shortcut for id with different defaults), and the Introduction to Writing Plugins for RKWard

Examples

# an example checkbox XML node
cbox1 <- rk.XML.cbox(label="foo", value="foo1", id.name="CheckboxFoo.ID")
id("The variable name is: ", cbox1, "!")

rkward-community/rkwarddev documentation built on May 9, 2022, 3:02 p.m.