MediaWiki Weirdness

From evermeet.cx Wiki
Revision as of 19:41, 25 October 2017 by Tessus (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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}}