idq: Get a quoted element ID

View source: R/idq.R

idqR Documentation

Get a quoted element ID

Description

This is actually a convenience wrapper for id and returns the XML ID of XiMpLe nodes in quoted format, optionally with an attached modifier.

Usage

idq(obj, modifiers = NULL, check.modifiers = TRUE, js = TRUE, quote = "\"")

Arguments

obj

An object of class XiMpLe.node containig an ID to extract.

modifiers

A character vector with modifiers you'd like to apply to the XML node property.

check.modifiers

Logical, if TRUE the given modifiers will be checked for validity. Should only be turned off if you know what you're doing.

js

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

quote

Character string to be used for quoting.

Details

You can use this function to write almost literal JavaScript code, but still be able to extract IDs from generated R objects.

Value

A character string.

Note

You should always nest this function inside an id call (or a similar wrapper) to prevent rk.paste.JS from appending newline characters – see the example section.

Examples

myCheckbox <- rk.XML.cbox("Check for action")
rk.paste.JS(id("var x = getBoolean(", idq(myCheckbox, modifiers="state"), ");"))

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