lualatex-tools / luaformatters

Creating macros for LuaLaTeX packages
GNU General Public License v3.0
0 stars 0 forks source link

Add formatter tree to existing instance #12

Closed uliska closed 5 years ago

uliska commented 5 years ago

Currently the formatters are (only) initialized through Templates:setup, and while it is possible to patch additional formatters in later (like it is done to some extent with the docstrings functions) there should be a clean path to add formatters to an existing instance. This will for example make it possible to load config tables from various definition files for a modular composition of commands.

This should be a method accepting the same structure as setup(). It has to be thought of how to handle the namespace. Should the namespace be automatically extended when adding new trees?

uliska commented 5 years ago

I realized that this is not optional but a crucial possibility. Adding a configuration table can also override existing formatters.

This will be a typical means to customize templates provided by a package: A package defines a formatter tree, and the client document loads another tree to partially override formatters.

See also the referencing follow-up issue #14

uliska commented 5 years ago

Such a function must have an option deciding how to deal with name clashes. An added tree can be used as a customization (in which case formatters of the same name should be overwritten), or as an addition (when composing a macro library, in which case a warning -- or an error? -- should be triggered).

uliska commented 5 years ago

Partly obsolete through and partly discussed in #25