pt-verb/conj
I'm not sure how this could be made much simpler. It's quite easy to understand compared to the current version and its nested template madness (pt-verb/doWork/add etc). And the code I wrote is not doing much - some lookups and data presentation. How would you simplify this ?
Well, the templates that Daniel Carrero made are often quite convoluted.
As far as generating a table goes, I use the approach you see in Module:hu-nominals. At the bottom is a make_table function which takes a list of forms and puts them in a table. Everything in the tableCreator module could replaced with a function like that, in theory.
While having the endings as pure data can work, there are often situations where the preceding stem changes depending on what kind of ending is added, and other things like that. So my preference is to treat inflection types as functions, rather than as lists of endings. That way it's much easier to account for predictable changes.
Agreed, the table generation code is not straightforward, but there are a few conditionals in there. It also combines the functionality of both {{pt-conj-2pp}}
and {{pt-conj}}
. As for the data-based approach, it is obviously not as powerful and elegant as a generative approach but simple to implement and understand.
My goal was to create a drop-in replacement for the current inflection code which would produce exactly the same output, with better performance and maintainability.
Once that is in place we can look at ways to replace the data with generators, I think Ungoliant_MMDCCLXIV (talk • contribs) had some ideas for that already. I'm a fan of doing refactorings step-by-step and not in one big swoop.