Java selector-based html template library similar to Enlive

Does anyone know of a nature-like template library for Java on Enlive ?

The concept of using simple html for pages without any markup inside and using the equivalent CSS selectors to fill the page with dynamic data seems to me very nice.

For more information about which patterns I'm looking for, look at

+6
source share
3 answers

If it’s not too late, I would advise you to take a look at Moulder , a template library where you create a page by selecting elements from the original template and applying transformations to them. More resources on this subject:

Disclaimer I am the author of this library.

+6
source

because expectation depends on clojure elegance of expression to do its magic, implication in java is likely to lose this magic.

"Enlive's approach to templates is functional and decouples design and presentation logic." and "There is a kind of control inversion here. In most major template systems, templates control the presentation logic." this is likely to require extensive use of the “visitor pattern” to execute in the hidden java library.

Most likely, it will be better for you to transfer the java components that you need to open the world of non-clojure. and write your templates in clojure. Although I understand that there are many good reasons why this approach may not be appropriate for your project / organization.

+4
source

I watched another night on James Strachan's label on ScalaExchange about Scalate.

This is a template engine containing a set of template templates. I looked at it to use the Mustache part, bu has a template system in it called Scuery, which is also based on CSS / JQuery, for example selectors.

This is actually a good presentation that shows the implementation of a wide range of template solutions. Scaml + Markdown looks very good.

Strictly speaking, this is scala, but AFAICT you can just use the API with Java. Of course, some template languages ​​have a built-in DSL scala.

+2
source

Source: https://habr.com/ru/post/891104/


All Articles