Closed benzen closed 5 months ago
I am not really understanding this Issue. Maybe I am wrong but I see here 2 different features.
On one hand it feels like you are purposing to have some way of defining an HtmlFlow view mixing both HTML through the DSL and HTML from a String. And it sounds like what is proposed here: https://github.com/xmlet/HtmlFlow/issues/49. Is that?
On the other hand, you are also proposing a different kind of API regarding nested function approach (like j2html) rather than method chaining (as it is in HtmlFlow).
Can you clarify please?
I'm not interested in the first, as I've never seen a case where I would need something like this. Still I understand different people may have different need.
I'm interested in the second point, nested function. On advantage for this in my opinion is that it make it easier to use formatter. With the chainging my concern is that we need to have some special formatting to be able to read/understand it easly.
The spring security api used to have a massive chaing api also. What was developped recently is much less based on chaning and format quit normally, maybe this could be an inspiration for this projet, with j2html.
But what is important to me is to keep the performance and the concept that were developped for htmlFlow. Which i found really cool.
Hope help clarify my proposition
I really enjoy the impact html flow has when working with spring mvc. It force me to better decompose data providing, and computation done to ease the work of rendering the HTML template.
But I'm not so much found of the syntax, and I'm looking for a different way of building templates. I hope to open the conservation, more than request any change.
With the advent of String template with custom processor, I'm wondering if a template engin could be build with string template and a custom processor.
For sure such a template engine would loose it's type safty in comparision to htmlflow. But when using thymleaf I never really missed it, since browser would make quit a nice job to accept (aka work arround) incorrect html response. Plus, in such a senario, we could integreate a validation phase in a devtools, in the spirit of what was done in React (error are given with much details in a dev environement).
Also composing template feels more natural to me in java than in thymleaf. For sure using a internal DSL is the nicest way to work (in my opinion), but in java it's also the most invloving.
With sealed interface and record, an complete api could be produce with a reduce effort, and produce a very diffrent result that what is today possible with HtmlFlow. Maybe something along thoses lines
This exemple would also be nicer to work with when using formatter, which is harsh with the current htmlFlow template.
I can see how a completely dynamic template based on this could be made easly. Where I have no real understanding, is how to create partly static template, and partly dynamic, and how their processing differ.