You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a variable of type (string, string)[] or string[string] it should be possible to apply all items in the array as attributes for any tag such that the keys (or first items in tuples) are the attribute names and the values (or second items in tuples) are the attribute values.
So for a given variable like this
string[string] myAttrs = ["src": "image.png", "alt": "cool image", "title": "this is a cool image"];
it would be possible to splat it onto some kind of element, let's say a <div> element, for example with a syntax that could look like this:
div(*myAttrs, extra="attributes here")
resulting in this HTML: (attribute order not guaranteed with AA but should be guaranteed with list of tuples)
<divsrc="image.png" alt="cool image" title="this is a cool image" extra="attributes here">
This should be generic to work with any input ranges of key/value pairs or 2 item tuples as well as any value types. For attributes that are specified multiple times, or implicitly from other syntax, the same rules as typing out all the attributes now should apply. (e.g. combining .dot style class names with class attributes)
For a variable of type
(string, string)[]
orstring[string]
it should be possible to apply all items in the array as attributes for any tag such that the keys (or first items in tuples) are the attribute names and the values (or second items in tuples) are the attribute values.So for a given variable like this
it would be possible to splat it onto some kind of element, let's say a
<div>
element, for example with a syntax that could look like this:resulting in this HTML: (attribute order not guaranteed with AA but should be guaranteed with list of tuples)
This should be generic to work with any input ranges of key/value pairs or 2 item tuples as well as any value types. For attributes that are specified multiple times, or implicitly from other syntax, the same rules as typing out all the attributes now should apply. (e.g. combining
.dot
style class names with class attributes)See https://forum.dlang.org/post/[email protected]
The text was updated successfully, but these errors were encountered: