D
D
Developers
Search…
Directives
Blueprints use several types of directives, each with a distinct function:

Static, Plain Text

Text is the most basic content your blueprint can contain. In fact, this is a completely valid blueprint, even though it doesn't contain any dynamic data:
1
Just simple text
Copied!
Since all strings are processed as Unicode, all Unicode characters are allowed, including emojis or special control characters.
In some situations, you want to use plain text inside the control tags, for example, to define the value of a substitution parameter. In this case, you can enclose it with double quotes to tell the syntax parser to ignore it:
1
Just a simple text: {{ text.suffixed("_") }}
Copied!
Note - ignoring only works inside computed areas - you can use quotes outside them to participate in the output. The syntax engine is smart enough to know that quotes are expected or missing and in most cases will still produce valid results without them.

Substitutions

Substitutions allow replacing certain parts of the blueprint with dynamic data provided by variables, functions, or any other structure containing data.
1
Username: {{ name }} -> Username: Jiri
Copied!
The data can also be further refined using transformers:
1
Username: {{ name.uppercased() }} -> Username: JIRI
Copied!
Substitutions and transformers are very powerful tools because they allow you to turn static templates into dynamic definitions - see the dedicated section for all the options.

Flows

Flows refer to definition structures that control the flow of execution - conditions, loops, tree-traversals, and others. Flows start with {[ and end with ]} tags respectively, and must be closed with {[/]}:
1
{[ for name in names ]}
2
- {{ name }}
3
{[/]}
Copied!
Some flows change or enhance data inside the blocks they define. In the example above, the value of the property name will always be different with each pass of the loop. When running with appropriate data (names = [Anna, George, Peter]), the output will look like this:
1
- Anna
2
- George
3
- Peter
Copied!
See the dedicated section for all the options.

Functions

Functions have two distinct use cases - computing and data retrieval. Functions start with @ and are followed by a function definition and its properties:
1
{[ for token in @ds.allTokens() ]}
2
- {{ token.meta.name }}
3
{[/]}
Copied!
In the example above, we are requesting data from the currently opened project to retrieve all screens - and then print out their names. When run with appropriate data, the output will look like this:
1
- cta
2
- primary
3
- secondary
Copied!
See the dedicated section for all the options.

Comments

Blueprints can get really complex really quickly, especially for tasks concerning code generation. Comment syntax is supported to enhance maintainability of blueprint code. Comments are enclosed within {* and *} tags:
1
{* XML Node *}
2
<doc />
Copied!
Comments are also not constrained by their position and can be part of the plain text:
1
<doc name="{{ data.name }}" /> {* XML Node *}
2
3
or even
4
5
<doc name="{{ data.name }}" {* XML Node *} />
Copied!
Finally, multi-line comments are supported as well:
1
{*
2
XML Nodes
3
- Docs
4
- Pages
5
*}
6
<docs />
7
<pages />
Copied!
Comments can contain any character as everything inside a comment is ignored and does not contribute to the output.
Last modified 6mo ago