Difference between revisions of "Inline Expressions"
(17 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
{| class="wikitable sortable" | {| class="wikitable sortable" | ||
+ | |+ Expression syntax | ||
|- | |- | ||
! Expression !! Example !! Since Version !! class="unsortable" | Description | ! Expression !! Example !! Since Version !! class="unsortable" | Description | ||
Line 15: | Line 16: | ||
|- | |- | ||
| <code>{ico:{ICON}}</code> || <code>{ico:home}</code> || data-sort-value=0|0.1.0 || | | <code>{ico:{ICON}}</code> || <code>{ico:home}</code> || data-sort-value=0|0.1.0 || | ||
− | Icon. The <code>{ICON}</code> part must be replaced with the icon name. Please see | + | Icon. The <code>{ICON}</code> part must be replaced with the icon name. Please see [[Icons]] for possible values. |
|- | |- | ||
| <code>{ico:{COLOR}:{ICON}}</code> || <code>{ico:msx-red:home}</code> || data-sort-value=0|0.1.0 || | | <code>{ico:{COLOR}:{ICON}}</code> || <code>{ico:msx-red:home}</code> || data-sort-value=0|0.1.0 || | ||
− | Colored icon. The <code>{COLOR}</code> part must be replaced with the color value and the <code>{ICON}</code> part must be replaced with the icon name. Please see | + | Colored icon. The <code>{COLOR}</code> part must be replaced with the color value and the <code>{ICON}</code> part must be replaced with the icon name. Please see [[Colors]] and [[Icons]] for possible values. |
|- | |- | ||
| <code>{txt:{COLOR}:{TEXT}}</code> || <code>{txt:msx-red:Hello there!}</code> || data-sort-value=0|0.1.0 || | | <code>{txt:{COLOR}:{TEXT}}</code> || <code>{txt:msx-red:Hello there!}</code> || data-sort-value=0|0.1.0 || | ||
− | Colored text. The <code>{COLOR}</code> part must be replaced with the color value and the <code>{TEXT}</code> part must be replaced with any text. Please see '''[[Colors]] | + | Colored text. The <code>{COLOR}</code> part must be replaced with the color value and the <code>{TEXT}</code> part must be replaced with any text. Please see [[Colors]] for possible color values. |
+ | |- | ||
+ | | <code>{chr:{CHARACTER}}</code> || <code>{chr:copy}</code><br/><code>{chr:#169}</code> || data-sort-value='''145'''|'''0.1.145''' || | ||
+ | Character entity. The <code>{CHARACTER}</code> part must be replaced with an HTML character entity name or number without the leading <code>&</code> and trailing <code>;</code> character (e.g. <code>"{chr:copy}"</code> → <code>"&copy;"</code> → "©"). | ||
+ | |- | ||
+ | | <code>{chr:{COLOR}:{CHARACTER}}</code> || <code>{chr:msx-red:copy}</code><br/><code>{chr:msx-red:#169}</code> || data-sort-value='''145'''|'''0.1.145''' || | ||
+ | Colored character entity. The <code>{COLOR}</code> part must be replaced with the color value and the <code>{CHARACTER}</code> part must be replaced with an HTML character entity name or number without the leading <code>&</code> and trailing <code>;</code> character (e.g. <code>"{chr:msx-red:copy}"</code> → <code>"<span style="color:#c9302c">&copy;</span>"</code> → "<span style="color:#c9302c">©</span>"). Please see [[Colors]] for possible color values. | ||
|- | |- | ||
| <code>{context:{PROPERTY}}</code> || <code>{context:label}</code> || data-sort-value=0|0.1.0 || | | <code>{context:{PROPERTY}}</code> || <code>{context:label}</code> || data-sort-value=0|0.1.0 || | ||
− | This is a very special inline expression and can only be used inside the <code>data</code> property of a template object. It is used to reference properties of a templated item. The <code>{PROPERTY}</code> part must be replaced with any property that is available in the templated item (e.g. if the item has a property <code>"customProperty": "customValue"</code>, it can be referenced with <code>"{context:customProperty}"</code> → <code>"customValue"</code>). The referenced property must exist, otherwise the expression can not be replaced and will remain as it is (e.g. <code>"{context:missingProperty}"</code> → <code>"{context:missingProperty}"</code>). Additionally, the value of the referenced property must be indicated as string, otherwise the expression is removed (e.g. <code>"{context:invalidProperty}"</code> → <code>""</code>). | + | This is a very special inline expression and can only be used inside the <code>data</code> property of a template object. It is used to reference properties of a templated item. The <code>{PROPERTY}</code> part must be replaced with any property that is available in the templated item (e.g. if the item has a property <code>"customProperty": "customValue"</code>, it can be referenced with <code>"{context:customProperty}"</code> → <code>"customValue"</code>). The referenced property must exist (either in the templated item or in the template object), otherwise the expression can not be replaced and will remain as it is (e.g. <code>"{context:missingProperty}"</code> → <code>"{context:missingProperty}"</code>). Additionally, the value of the referenced property must be indicated as string, otherwise the expression is removed (e.g. <code>"{context:invalidProperty}"</code> → <code>""</code>). |
'''Note: Since version 0.1.110, also the <code>properties</code>, <code>live</code>, <code>selection</code>, and <code>options</code> property of a template object supports this inline expression.''' | '''Note: Since version 0.1.110, also the <code>properties</code>, <code>live</code>, <code>selection</code>, and <code>options</code> property of a template object supports this inline expression.''' |
Latest revision as of 13:07, 25 May 2022
Most of the text properties support inline expressions for adding icons or coloring text parts. Each expression starts with character {
and ends with character }
. Nested expressions are not supported.
Expression | Example | Since Version | Description |
---|---|---|---|
{sp} |
{sp} |
0.1.0 |
Non-breakable space. |
{tb} |
{tb} |
0.1.0 |
Non-breakable tab. |
{br} |
{br} |
0.1.0 |
Line break. |
{ico:{ICON}} |
{ico:home} |
0.1.0 |
Icon. The |
{ico:{COLOR}:{ICON}} |
{ico:msx-red:home} |
0.1.0 |
Colored icon. The |
{txt:{COLOR}:{TEXT}} |
{txt:msx-red:Hello there!} |
0.1.0 |
Colored text. The |
{chr:{CHARACTER}} |
{chr:copy} {chr:#169} |
0.1.145 |
Character entity. The |
{chr:{COLOR}:{CHARACTER}} |
{chr:msx-red:copy} {chr:msx-red:#169} |
0.1.145 |
Colored character entity. The |
{context:{PROPERTY}} |
{context:label} |
0.1.0 |
This is a very special inline expression and can only be used inside the Note: Since version 0.1.110, also the |
{unknown} |
{unknown} |
0.1.0 |
Any unknown expression is returned as it is without the braces (e.g. |