digitalmars.D.learn - How to add class in DIET template
- Suliman (14/14) Jun 22 2017 I need to get external variable and make class by it's value
- Martin Tschierschke (6/20) Jun 23 2017 You can use the html syntax for the class parameter, the
- Steven Schveighoffer (7/13) Jun 23 2017 Yes, I just found out recently -- when you don't use quotes for an
I need to get external variable and make class by it's value - string mystr = "lng-" ~ language; - foreach(i, line; arrayOfLines ) li I need to get HTML code like this: <li> <code class="lng-d">some D code</code> </li> But class name become "mystr" and I am getting: <li> <code class="mystr">some D code</code> </li> How to fix it?
Jun 22 2017
On Friday, 23 June 2017 at 06:59:22 UTC, Suliman wrote:I need to get external variable and make class by it's value - string mystr = "lng-" ~ language; - foreach(i, line; arrayOfLines ) li I need to get HTML code like this: <li> <code class="lng-d">some D code</code> </li> But class name become "mystr" and I am getting: <li> <code class="mystr">some D code</code> </li> How to fix it?You can use the html syntax for the class parameter, the funny/nice thing is, that mystr can be used directly without works.
Jun 23 2017
On 6/23/17 12:06 PM, Martin Tschierschke wrote:You can use the html syntax for the class parameter, the funny/nice works.Yes, I just found out recently -- when you don't use quotes for an attribute value, it's treated as a D expression (and then interpolated). If that D expression is of type bool, then the attribute is added or not based on the value of that bool. Good for things like checkboxes and 'checked'. -Steve
Jun 23 2017