vibe.d selectively include attribute into tag using diet template

JG someone at somewhere.com
Mon Mar 1 09:35:29 UTC 2021


On Sunday, 28 February 2021 at 18:10:26 UTC, Steven Schveighoffer 
wrote:
> 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

Thanks



More information about the Digitalmars-d-learn mailing list