3

I just installed Mediawiki and realized that it is very complicated to configure it for newbie.

As one of my first entry I wanted to change font color with:

{{ font color | green | green text }}

To do that I imported Template:Font color from Wikipedia Special:Export page, but still as the result I don't get coloured text, but:

{{ safesubst:#if:

| {{ safesubst:#if: 
     | {{ safesubst:#ifeq:  | yes
     | [[ {{ safesubst:#if:1|  }}|{{ safesubst:#if:1|  }}]]
     | [[|{{ safesubst:#if:1|  }}]]
     }}
   | {{ safesubst:#if:1|  }}
   }}
| {{ safesubst:#if: 
     | {{ safesubst:#ifeq:  | yes
     | [[ {{ safesubst:#if:1|  green text  }} |{{ safesubst:#if:1|  green text  }}]]
     | [[ {{ safesubst:#if:1|  }} |{{ safesubst:#if:1|  green text  }}]]
   }}
 | {{ safesubst:#if:1|  green text  }}
 }}

}} 

Could you please help me?

Nemo
  • 2,441
  • 2
  • 29
  • 63
bLAZ
  • 1,689
  • 4
  • 19
  • 31

2 Answers2

5

You're better off not trying to import templates from Wikipedia. They have grown fiendishly complex over the years, and you pretty much need to be an expert in wiki template markup to be able to change anything.

Instead, I recommend making your own. They can be really simple, and because you own the wiki you can easily add your own custom CSS. For example, if you want text in different colours, you can do the following. First, add some rules to your MediaWiki:Common.css page:

.text-color-green {
  color: green;
}

.text-color-blue {
  color: blue;
}

.text-color-red {
  color: red;
}

Then create Template:Font color with this content:

<span class="text-color-{{{1}}}">{{{2}}}</span>

Then you can make green text with {{Font color|green|green text}}, red text with {{Font color|red|red text}}, etc.

Doing this in CSS rather than with inline styles makes it easy to update the styles later, and should be faster for browsers to render.

Better still would be to make the templates semantic. For example, if you want to colour text green whenever something has been approved, you can add the following to MediaWiki:Common.css:

.approved {
  color: green;
}

And then create Template:Approved with the following content:

<span class="approved">{{{1}}}</span>

Then you can make approved text by calling {{Approved|some approved text}}. Then, in the future, if you decide you need all approved text to be bolded as well, you can just add font-weight: bold; to the approved style and everything will be updated.

Jack Taylor
  • 5,588
  • 19
  • 35
2

MediaWiki sucks for newbies who just want to throw a wiki together. It first needs plenty of extra work to get decent, especially in regard to templates.

Maybe you left out an extension like ParserFunctions or Scribunto? Templates use other templates, did you tick the box "Include templates"?

Here's a helpful blog post on how to import Wikipedia Templates into your own MediaWiki.

Rob Kam
  • 10,063
  • 14
  • 55
  • 65
  • 1
    I saw that blog post before and I tried to follow it, but what I overlooked is ParserFunctions extension. Now I installed it and the template is working perfectly. Thanks! – bLAZ Jun 06 '17 at 18:26