Thread overview
Diet template syntax highlighting / alternatives?
Mar 14, 2019
Foo Bar
Mar 15, 2019
Johannes Loher
Mar 15, 2019
Sönke Ludwig
Mar 21, 2019
rjframe
March 14, 2019
While I've always been a big fan of vibe.d, diet templates have never really tickled my pickle. I don't like how much different it is from plain HTML, and I always prefer something like EJS (https://ejs.co).

I was hoping that there was some sort of alternative to diet templates, something with more similar syntax to EJS. Are there any such alternatives?

If there are no alternatives, are there any sort of syntax highlighting plugins for vim that support diet? That would at least make diet a little easier to work with.

Thanks!
March 15, 2019
Am 14.03.19 um 23:22 schrieb Foo Bar:
> While I've always been a big fan of vibe.d, diet templates have never really tickled my pickle. I don't like how much different it is from plain HTML, and I always prefer something like EJS (https://ejs.co).
> 
> I was hoping that there was some sort of alternative to diet templates, something with more similar syntax to EJS. Are there any such alternatives?
> 
> If there are no alternatives, are there any sort of syntax highlighting plugins for vim that support diet? That would at least make diet a little easier to work with.
> 
> Thanks!

I don't really think there is a real alternative at the moment if you
plan to only use D. Some other frameworks use a different template
syntax, e.g.
Diamond MVC , which builds on top of vibe.d
(https://github.com/DiamondMVC/Diamond) or hunt-framework, which is
completely independent and developed by the Chinese community
(https://github.com/huntlabs/hunt-framework).

If you want to stick with "plain" vibe.d, but simply want syntax highlighting for diet templates, I suggest to use Laurent Treguier's extension for VS Code (https://github.com/LaurentTreguier/diet-vscode). In my experience, it worked really well.
March 15, 2019
Am 14.03.2019 um 23:22 schrieb Foo Bar:
> While I've always been a big fan of vibe.d, diet templates have never really tickled my pickle. I don't like how much different it is from plain HTML, and I always prefer something like EJS (https://ejs.co).
> 
> I was hoping that there was some sort of alternative to diet templates, something with more similar syntax to EJS. Are there any such alternatives?
> 
> If there are no alternatives, are there any sort of syntax highlighting plugins for vim that support diet? That would at least make diet a little easier to work with.
> 
> Thanks!

Have a look at https://code.dlang.org/packages/vayne

I haven't used it myself, but I would guess that this is currently the best supported alternative. There are also some similar approaches:

https://code.dlang.org/packages/mustache-d
https://code.dlang.org/packages/temple

The latter is probably closest to EJS, syntax-wise.
March 21, 2019
On Thu, 14 Mar 2019 22:22:33 +0000, Foo Bar wrote:

> If there are no alternatives, are there any sort of syntax highlighting plugins for vim that support diet? That would at least make diet a little easier to work with.

Any pug syntax highlighter will work for diet; e.g., https://github.com/digitaltoad/vim-pug

ftdetect: autocmd BufRead,BufNewFile *.pug,*.jade,*.diet set filetype=pug

--Ryan