Skip to content

Latest commit

 

History

History
95 lines (68 loc) · 3.16 KB

File metadata and controls

95 lines (68 loc) · 3.16 KB

Text Node

The Text Node is used to insert narrative content into your report. It supports both fixed, static text blocks and dynamic content that integrates processed values directly from loaded data files.

Field Type Description Default Value

id

string

Optional. Identifies the text node within the report. Used for internal cross referencing

null

type

string

Must be set to "text".

"text"

text

string or object

The text content or a nested Text object.

Required

ref

string

The name of the data field to reference for dynamic placeholder resolution.

null

Static Text

Static content is the simplest form of a content node and does not require the ref field.

Note
If the text field is defined as a raw string, the engine automatically treats it as static content unless placeholders are detected.
{
  "type":"text",
  "text":"My custom static text!"
}

Dynamic text uses placeholders (@{…​}@) to inject data values. The content inside the placeholders follows a simple path and operator syntax.

Path Syntax

Use dot (.) notation to traverse nested data structures within the data source referenced by the data field.

  • Dictionary/JSON: Use keys: @{data_name.key.subkey}@

  • Lists/Arrays: Use numerical indices: @{data_list.0.item_name}@

Value Operators

Simple operators can be applied to the retrieved value using the pipe (|) syntax to perform common transformations directly at render-time.

Operator Description Example

length

Returns the size of a list, array, or string.

@{list_data | length}@

Rendering dynamic text

Assume a data file named "results" was loaded, containing the data: {"version": "1.2.3", "timings": [1, 2, 3]}.

{
  "type": "text", "ref": "results",
  "text": "The report was generated for version @{results.version}@. We analyzed @{results.timings | length}@ samples."
}
// Renders as: "The report was generated for version 1.2.3. We analyzed 3 samples."

Text Configuration (Nested Object)

If you need to override the default dynamic behavior (e.g., change the placeholder delimiters), you can use the detailed configuration object instead of a raw string for the text field.

Field Type Description Default Value

content

string

The text string containing the narrative and any placeholders.

Required

mode

string ("static", "dynamic")

Explicitly controls processing. If omitted, the mode is inferred based on whether placeholders are detected in the content.

Inferred

placeholder_expr

string

The regular expression used to identify placeholders in the text.

@{([^}]+)}@

Overriding dynamic behaviour

Assume a data file named "results" was loaded, containing the data: {"version": "1.2.3", "timings": [1, 2, 3]}.

{
  "type": "text", "ref": "results",
  "text":{
    "placeholder":"[[([^}]+)]]",
    "content":"The report was generated for version [[results.version]]. We analyzed [[results.timings | length]] samples.",
  }
}
// Renders as: "The report was generated for version 1.2.3. We analyzed 3 samples."