performSubstitutions() function
Performs substitutions on an input string using Liquid.
Signature
export declare function performSubstitutions(input: {
engine: LiquidEngine;
input: string;
substitutionsVariables: LiquidSubstitutionsVariables;
log: Logger;
maxIterations?: number;
maxOutputSize?: number;
}): Promise<string>;
Parameters
|
Parameter |
Type |
Description |
|---|---|---|
|
{ engine, input, substitutionsVariables, log, maxIterations, maxOutputSize, } |
(not declared) | |
|
input |
{ engine: LiquidEngine; input: string; substitutionsVariables: LiquidSubstitutionsVariables; log: Logger; maxIterations?: number; maxOutputSize?: number; } |
The input string, possibly containing substitutions. |
Returns
Promise<string>
The fully substituted string.
Exceptions
TemplateError If Liquid rendering fails, iteration limit is exceeded, or output size limit is exceeded.
Remarks
This function processes Liquid template syntax (variables and tags) by repeatedly rendering the input until no more substitutions are detected. The iterative approach supports nested substitutions where one property references another.
Processing workflow:
- Skip processing for empty strings to avoid unnecessary overhead.
- Prepare Liquid context with substitution variables.
- If
propertiesexist, wrap them inLiquidPropertiesDropfor lazy evaluation and nested substitution support. - If
matrixparameters exist, wrap them inLiquidMatrixDropfor template expansion variable access. - Iterate while Liquid syntax (
{{or{%) is present:- Parse and render the current string.
- Break if no changes occur (safety check).
- Continue with the substituted result.
- Return the fully substituted string.
The Drop pattern enables recursive property resolution: when a template accesses {{ properties.foo }} and foo contains {{ properties.bar }}, the next iteration resolves bar, and so on until no Liquid syntax remains.
Error handling:
Liquid rendering errors are caught, stripped of line number information (which can be misleading for nested templates), and re-thrown as ConfigurationError.
Generated via tsdoc2docusaurus 1.3.2 by API Extractor/Documenter 7.57.2.