On 6/17/21 4:22 PM, kdevel wrote:
On Thursday, 17 June 2021 at 19:14:28 UTC, Steven Schveighoffer wrote:
On 6/17/21 12:26 PM, JG wrote:

However, what I *have* wanted is to have attribute values support `Nullable!T` such that they are only included if the item is non-null. See [here](https://github.com/rejectedsoftware/diet-ng/issues/28).

BTW: Is it possible to replace the diet generator in vibe.d with a template engine like moustache [1] which is agnostic wrt the code it produces? In the past 25 or so years I frequently encountered designed HTML pages where only some data had to be inserted here or there. If I got the vibe.d model right one would have to reimplement these HTML pages in the diet language first.

[1] https://github.com/repeatedly/mustache-d


Of course. Vibe's diet support is wholly based on the diet-ng project, and you don't have to use it. It's just there out of the box.

when you do:

```d
res.render!("sometemplate.dt", all, my, args);
```

It's just a UFCS call. You could replace this with:

res.renderMustache(...)

Where you have to write the adapter. It's possible to get a char output range out of HTTPServerResponse, which you then can write to and it's just sent back to the client.

This seems like it would do the trick, you just have to pass the output range in as the sink:

https://mustache-d.dpldocs.info/mustache.MustacheEngine.render.2.html

-Steve

Reply via email to