News for hackers. Stuff that matters.
Re:Nim 2.0 thoughts by otherme123 on Saturday May 15, 2021 @05:00PM (#27168961)
Templating as in Jinja? I'm using Karax (https://github.com/karaxnim/karax#server-side-html-rendering) and it's awesome.
Re:Nim 2.0 thoughts by mrweasel on Sunday May 16, 2021 @02:47AM (#27171728)
That’s nothing like Jinja, it’s more like React. I just want text templating and not a virtual dom and I don’t want to build my HTML in Nim.
Re:Nim 2.0 thoughts by xigoi on Sunday May 16, 2021 @02:20PM (#27175802)
Re:Nim 2.0 thoughts by planetis on Sunday May 16, 2021 @03:10AM (#27171833)
We have many https://nimble.directory/search?query=template

Also karax can also work as on server side, no virtual dom in that scenario. People prefer it because of type checking over string templates.

Re:Nim 2.0 thoughts by mrweasel on Sunday May 16, 2021 @03:58AM (#27172009)
I think I tried most of those templating options, but some seems to have been abandoned, many try to abstract the html away and most are incomplete.

Nwt seemed like the most promising, but it don’t even allow loops in your template.

Re:Nim 2.0 thoughts by planetis on Sunday May 16, 2021 @04:38AM (#27172202)
I really don't understand what your requirements are. Again karax is well known and better alternative than all these (i.e loops and other control flow work as expected).
Re:Nim 2.0 thoughts by mrweasel on Sunday May 16, 2021 @05:01AM (#27172307)
Understandably, I don't think I explained it all that well.

If I look at the Karax example, it seems more like a way of building the HTML in Nim, but I want to write HTML. If you look at Jinja2, then it's HTML, but with a bit of embedded syntax to do loops, conditionals and string replacement, plus a few handy functions.

The built in templates in Go is a bit simplistic, but it's enough for my needs. So something like it would be nice.

As you pointed out the Karax it has type safety, which my suggestions doesn't have. It's also not required, because HTML/text templates doesn't need type safety, it's all just text.

Basically I want nwt, with loops and control statements implemented.

Re:Nim 2.0 thoughts by planetis on Sunday May 16, 2021 @05:29AM (#27172436)