I have a thymeleaf fragment with a lot of internal logic (around 500 lines of template code with loops and conditions) that creates a data table for some project requirements. As of now, I have to write the following line in order to use this fragment anywhere in my templates:
<th:block th:replace="ecobase/components/framework/dataGrid.html :: content( dataSource = ${dataSource} )"/>
Which means that I have to keep my template (dataGrid.html) somewhere in my templates folder. So I was wondering if it was possible to simplify this to something like this:
<div custom:grid="${dataSource}"/>
and with the usage of a custom dialect replace it with my custom table. So the only problem is that AFAIK I'd have to rewrite the whole 500-line thymeleaf template in Java code to put the result into structureHandler.setBody() in my processor.
The question is if there is a solution to somehow import my existing html template to the processor (from classpath maybe) and process it and then put into the tag with custom attribute?