vibe.d selectively include attribute into tag using diet template
Steven Schveighoffer
schveiguy at gmail.com
Sun Feb 28 18:10:26 UTC 2021
On 2/28/21 12:29 AM, JG wrote:
> On Saturday, 27 February 2021 at 19:12:55 UTC, Steven Schveighoffer wrote:
>>
>> If you use an expression without quotes
>> in diet, it becomes an interpolation.
>
> Would you mind explaining in more detail what this means? How could one
> use this, other than with booleans?
So if you have an expression as the right side of an attribute
assignment, it is treated as a D expression, which is then evaluated and
turned into string form.
So e.g. your original example:
tag(attribute='#{dexpression}')
can be written as:
tag(attribute=dexpression)
-Steve
More information about the Digitalmars-d-learn
mailing list