MediaWiki Weirdness
Introduction
I spent hours trying to debug some strange behaviour in MediaWiki and thought the solution, which I got from someone on IRC, might be beneficial to others.
When using a template, which invokes a LUA module, an additional line is added before the output. Turns out a bug T14974 has been filed a while back, but it looks like there's no desire to fix it.
Example
Invoking the module directly works as intended:
{{#invoke:module|func|...}}
Output here.
But when using a template, which calls the module, an additional line is prepended:
{{template_which_invokes_module|...}}
Output here.
Solution
In the template, add <nowiki />
before invoking the module:
<nowiki />{{#invoke:module|func}}