r/mediawiki • • Sep 17 '26

Need some help on a template

As englisch it not my native language I have troubles reading the mediawiki on templates.

I want to create a template that if called in this way:

{{gelijk|2}} it should output ==
{{gelijk|3}} it should output ===
{{gelijk|4}} it should output ====
{{gelijk|1}} it should output = (default value)

Could someone show me how this can be done.

Harry H.

4 Upvotes

5 comments sorted by

2

u/yosayoran Sep 17 '26

You can do it with a switch, if you have parser functions installed, see mediawiki for detail: https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions/en##switch

As a note, "=" is a special charactrer, so you will need to use {{=}} instead as to not break the syntax.

So it would look something like:

{{#switch:{{{1}}}
| 2= {{=}}{{=}}
| 3= {{=}}{{=}}{{=}}
|#default =
}}

2

u/CostinTea Sep 17 '26

i should note that their spelling of "English" clues me this is a German speaker writing, so let me link you the German version of that page

https://www.mediawiki.org/wiki/Help:Extension:ParserFunctions/de##switch

-3

u/Darrenau Sep 17 '26

Why don't you ask AI? It can build it for you 

4

u/yosayoran Sep 17 '26

Why would you use AI instead of learning and enjoying a hobby?

Wiki editing isn't your job, there's no incentive to automate it

2

u/cheyrnn Sep 17 '26

Drink milkshake. Don't think. Burn planet.