rk.JS.scan: Create JavaScript variables and functions from plugin XML

View source: R/rk.JS.scan.R

rk.JS.scanR Documentation

Create JavaScript variables and functions from plugin XML

Description

Create JavaScript variables and functions from plugin XML

Usage

rk.JS.scan(
  pXML,
  js = TRUE,
  add.abbrev = FALSE,
  guess.getter = FALSE,
  indent.by = rk.get.indent(),
  mode = "vars",
  script = NULL
)

Arguments

pXML

Either an object of class XiMpLe.doc or XiMpLe.node, or path to a plugin XML file.

js

Logical, if TRUE usable JavaScript code will be returned, otherwise a character vector with only the relevant ID names.

add.abbrev

Logical, if TRUE the JavaScript variables will all have a prefix with an three letter abbreviation of the XML tag type to improve the readability of the code. But it's probably better to add this in the XML code in the first place.

guess.getter

Logical, if TRUE try to get a good default getter function for JavaScript variable values. This will use some functions which were added with RKWard 0.6.1, and therefore raise the dependencies for your plugin/component accordingly. Nonetheless, it's recommended.

indent.by

Character string used to indent each entry if js=TRUE.

mode

Character string to set the operation mode. Currently, only "vars" and "preview" are supported. If mode="vars", scans for relevant tags and returns variable definitions or IDs. If mode="preview", scans only for occurring <preview /> nodes and returns proper function definitions for the JavaScript file.

script

Character string (or list of), the actual body of the JavaScript section we're scanning for. If not NULL, rk.JS.scan will try return only varaible definitions that are actually being used in the script code.

Value

A character vector.

See Also

Introduction to Writing Plugins for RKWard


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