Thread:User talk:CodeCat/Please change t- to behave like t when diacritics are autoremoved./reply (12)

@DTLHS: Re: "it's possible to just call eval with a local Lua instance": That will work in some cases, but not in others: many of our modules refer to MW features (such as the UTF-8 support), or to other modules. I think CodeCat's suggested approach, writing a module to present the data in a tractible format, is better even for Python.

@CodeCat: That worked out pretty well. What I did was, I added a formatDiacriticRemovalRulesAsJson function to Module:User:Ruakh that formats all the diacritic-removal rules into a JSON "text", and changed my bot to call [//en.wiktionary.org/w/api.php?format=xml&action=expandtemplates&text=&#x7B;&#x7B;%23invoke:User:Ruakh&#x7C;formatDiacriticRemovalRulesAsJson&#x7D;&#x7D; action=expandtemplates&text=&#x7B;&#x7B;%23invoke:User:Ruakh&#x7C;formatDiacriticRemovalRulesAsJson&#x7D;&#x7D;] to retrieve it, and apply the transformations accordingly. Thank you for the suggestion!

I think this approach will be useful for other bots/people/tools/tasks as well, so I'll see about starting a Module:Json to hold utility methods for generating JSON. ..