rk.JS.doc: Create JavaScript outline from RKWard plugin XML

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

rk.JS.docR Documentation

Create JavaScript outline from RKWard plugin XML

Description

You don't need to define a preview() function, as this can be added automatically by rkwarddev's code scanners.

Usage

rk.JS.doc(
  require = c(),
  variables = NULL,
  globals = NULL,
  results.header = NULL,
  header.add = list(),
  preprocess = NULL,
  calculate = NULL,
  printout = NULL,
  doPrintout = NULL,
  preview = FALSE,
  load.silencer = NULL,
  gen.info = TRUE,
  indent.by = rk.get.indent(),
  level = 2,
  guess.getter = FALSE
)

Arguments

require

A character vector with names of R packages that the dialog depends on.

variables

Either a character string to be included to read in all needed variables from the dialog (see rk.JS.scan), or a (list of) objects of class rk.JS.var which will be coerced into character. These variables will be defined in the calculate() and/or printout() functions.

globals

Like variables, but these variables will be defined globally. If variables is set as well, the function tries to remove duplicate definitions.

results.header

A character string to headline the printed results. Include escapes quotes (\") if needed. Set to FALSE or "" if you need more control and want to define the header section in printout.

header.add

A named list of additional info to add to the header. Each entry must be named add or addFromUI – see rk.JS.header for details.

preprocess

A character string to be included in the preprocess() function. This string will be pasted as-is, after require has been evaluated.

calculate

A character string to be included in the calculate() function. This string will be pasted as-is, after variables has been evaluated.

printout

A character string to be included in the printout() function. This string will be pasted as-is, after results.header has been evaluated. Appended after doPrintout if set (which is deprecated).

doPrintout

Deprecated: A character string to be included in the doPrintout() function. This string will be pasted as-is.

preview

Either a logical value, if TRUE, a preview() function will be added in any case. Can also be a character string to be used as-is inside the preview() function.

load.silencer

Either a character string (ID of probably a checkbox), or an object of class XiMpLe.node. This defines a switch you can add to your plugin, to set the require() call inside suppressMessages(), hence suppressing all load messages (except for warnings and errors) of required packages in the output.

gen.info

Logical, if TRUE a comment note will be written into the document, that it was generated by rkwarddev and changes should be done to the script. You can also provide a character string naming the very rkwarddev script file that generates this JS file, which will then also be added to the comment.

indent.by

A character string defining how indentation should be done.

level

Integer, which indentation level to use, minimum is 1.

guess.getter

Locigal, if TRUE try to get a good default getter function for JavaScript variable values. Only used if header.add contains XiMpLe nodes.

Details

For previews, use js(if("!is_preview") {...}) style JavaScript code to toggle between modes (applies to preprocess, calculate and printout).

Value

A character string.

See Also

rk.paste.JS, rk.JS.vars, rk.JS.array, js, echo, id, rk.JS.header, and the Introduction to Writing Plugins for RKWard


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