ultraq / thymeleaf-layout-dialect

A dialect for Thymeleaf that lets you build layouts and reusable templates in order to improve code reuse

Home Page:https://ultraq.github.io/thymeleaf-layout-dialect/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Refactor-ish tasks for version 3

ultraq opened this issue · comments

Some things to try for the next release, no guarantee I'll get around to them but it'll be neat to help clean up the codebase while I'm working on it:

  • Add extension methods to traverse models as if they were DOM elements, namely the ability to get the 'first element child' like https://developer.mozilla.org/en-US/docs/Web/API/Element/firstElementChild
  • Convert the ChildModelIterator into a general purpose model iterator. In conjunction with the above, that can replace the need for a specific child model iterator.
  • Find some way to better identify the model vs event extension methods in IModelExtensions: I got confused recently as it's not always clear which methods operate on what kind of objects
  • The whitespace creation in the insertModelWithWhitespace extension method could do with some work - it inserts Windows line ends instead of platform-specific ones, and its opposite removeModel doesn't have a "with whitespace" version which could clear up some formatting issues in the resulting output

Worked on what I could, but wow whitespace handling is a little annoying when you have to do it yourself! As for the other stuff, it's also kind of in the difficult basket no wonder it's been kinda ad-hoc all these years! 😅