Taxobox tests?
In september, I first write Module:MathRoman with import of template parameters to the end. But now to develope an equivalent of s:fr:Modèle:Auteur, I use a very well structured module, created by another user, Module:Author. The way to import parameters from template is strange but usefull, in the functions "fr" and "en".
I'm playing with modules (sorry, I generate a lot of changes due to bugs in my code).
You can check user:Hexasoft/test which calls Template:Taxobox-fr which uses Module:Taxobox-fr.
I also started to write a sub-module for all my tools : Module:Taxoboxoutils. It is mostly dedicated to my purpose but I also have some more generic functions such as cuting a string into "text" and "(homonymy)" when given string "text (homonymy)" (usefull to check the real part of the title, i.e. for italic parts of it).
I also find that parameters in modules do have the trailing spaces given in the template call! So I added a cleanup function to remove trailing and leading spaces.
BTW I failed to use "local config = frame.args" and then to read "config.pagename", which is 'nil' in my test. It seems in other templates to be the page name... I replaced it by preprocess("{{PAGENAME}}") but I guess it is not a good way as preprocess() is claimed to be heavy-process stuff.
Regards,
I created: Uroplatus guentheri and Rosa canina (plante) for testing my infobox template/module (you need my CSS to really see it). These modules are fun! :)
@Hexasoft: I think you can't directly use wiki markup directly in a module (I think it is possible, despite this, but you need to do some extra stuff to do it—you can't generate "foo {{bar}} bazbazbaz" just with return "foo {{tl|bar}} {{#invoke:String|rep|baz|3}}"
).
The reason I say this is because the section "Returning text" on mw:Extension:Scribunto/Lua reference manual says this:
{{#invoke:}}
.
"Hello, [[world]]! {{welcome}}"
, the page will read "Hello, world! {{welcome}}".{{subst:#invoke:}}
only other attempted substitutions will be processed. Since the failed substitution will remain in the wikitext, they will then be processed on the next edit. This should generally be avoided.So, most likely, the code preprocess("{{PAGENAME}}")
in a Lua module would continue to be preprocess("{{PAGENAME}}")
, instead of compiling to preprocess("pagename")
.
(The reason I made this reply is because I saw preprocess("{{PAGENAME}}")
in Hexasoft's reply that is the 5th reply (including the first reply, which was by Hexasoft) in this thread.)