generate_template_variables: Build the Whisker template variable list for the shared shell

View source: R/template-variables.R

generate_template_variablesR Documentation

Build the Whisker template variable list for the shared shell

Description

Constructs the named list passed to whisker::whisker.render() when assembling the Electron app. Kept separate from process_templates() so the variable construction is testable independently.

Usage

generate_template_variables(
  app_name,
  app_slug,
  app_type,
  runtime_strategy,
  icon,
  backend_module,
  brand,
  config,
  is_multi_app = FALSE,
  apps_manifest = NULL
)

Arguments

app_name

Character. Display name of the app.

app_slug

Character. Path-safe slug derived from app_name.

app_type

Character. "r-shiny" or "py-shiny".

runtime_strategy

Character. Resolved runtime strategy.

icon

Character path to icon file, or NULL.

backend_module

Character. Resolved backend filename (e.g., "native-r.js").

brand

List or NULL. Parsed ⁠_brand.yml⁠ contents if present.

config

List. Effective merged configuration.

is_multi_app

Logical.

apps_manifest

List or NULL. Multi-app manifest entries.

Details

Most variables here correspond to a {{...}} placeholder in inst/electron/shared/main.js, lifecycle.html, or launcher.html. The list is a superset: some entries are serialized into backend_config_json (and consumed by the backend modules rather than a template) or are reserved for future placeholders. Adding a new placeholder requires adding it here.

A configuration string that a template's JavaScript (main.js or an inline ⁠<script>⁠ in an HTML template) places inside a single-quoted literal also has an escaped ⁠*_js⁠ entry (see js_str()), which the template renders with a triple mustache, as in '{{{app_name_js}}}'. JSON inlined into a script is built with json_for_script(). The plain entries are HTML-escaped by a double mustache and belong in HTML markup.

Value

Named list suitable for Whisker rendering.


shinyelectron documentation built on Dec. 3, 2026, 9:07 a.m.