Pattern Parameters

Pattern parameters are a means to hydrate data in an included pattern, but not further downstream. They are yet another option for hydrating patterns with varying degrees of granularity.

Pattern parameters are a Feplet feature. They are an add-on to the Mustache spec. Feplet is otherwise fully compliant with the Mustache spec, as per the original Ruby implementation.

Pattern Parameter Syntax

The keys listed in the pattern parameters need to match variable names in the included pattern. The values listed for each key will replace the variables. For example:

components-top-level:
{{> compounds-mid-level(content: 'Mid-level only') }}
compounds-mid-level:
<p>{{ content }}</p>
{{> elements-bottom-level }}
elements-bottom-level:
<p>{{ content }}</p>
Rendered as:
<p>Mid-level only</p>
<p></p>

Advanced Syntax

Parameters can be any valid JSON5, minus the exterior curly braces:

{{> patternType-patternName(
  bool: false,
  num: 0,
  str: 'string',
  'str w spaces': "string with 'single quotes'"
) }}

You can even submit objects as values, but be sure to space curly braces so they are not mistaken for closing tags }}

{{> patternType-patternName(
  obj: { deeperObj: { valid?: true } }
) }}