Browse Source
Allow upstream nodes to define variables using <var="name">value</var> syntax in their text content. These are parsed and made available as @name variables in the template, coexisting with the existing named variable system (which takes precedence on name conflicts). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>handoff-20260429-1057
3 changed files with 92 additions and 19 deletions
@ -0,0 +1,13 @@ |
|||
/** |
|||
* Parses inline <var="name">value</var> tags from text. |
|||
* Returns an array of { name, value } pairs. |
|||
*/ |
|||
export function parseVarTags(text: string): Array<{ name: string; value: string }> { |
|||
const regex = /<var="(\w+)">([\s\S]*?)<\/var>/g; |
|||
const vars: Array<{ name: string; value: string }> = []; |
|||
let match; |
|||
while ((match = regex.exec(text)) !== null) { |
|||
vars.push({ name: match[1], value: match[2] }); |
|||
} |
|||
return vars; |
|||
} |
|||
Loading…
Reference in new issue