Working With MediaWiki

Read Working With MediaWiki for Free Online Page A

Book: Read Working With MediaWiki for Free Online
Authors: Yaron Koren
a":
{{#spacify:{{#reverse:abc}}}}
{{#spacify:abc}}
    The following calls, in most cases, would fail, however:
{{#reverse:abc}}
abc
    That’s because the string that would be “spacified” would be the literal string ’{{#reverse:abc}}’ or ’abc’. In other words, tag functions don’t allow their inputs to be parsed -- a weakness that has made them unusable for many situations.
    Two features of MediaWiki, though, can help to reduce this difference between tag and parser functions. The first is the#tag function, which is part of core MediaWiki. #tag lets tag functions be called as parser functions, so that their arguments can be parsed. So if only were defined and not #spacify, you could call the following, and it would, in fact, display "c b a":
{{#tag:spacify|abc}}
    The second is that, since version 1.16 of MediaWiki, tag functions can in fact be defined so that they parse their own parameters, just as parser functions do. As of this writing, few tag functions have been defined with this behavior, but hopefully this will become more standard in the future.
    Besides #tag, there are a variety of other parser functions defined in core MediaWiki. There are also a few tags. And some parser functions are called without the ’#’ character at the beginning — for the most part, this is based on when that parser function was added; older functions do not have it. Here are some of the important parser functions defined in MediaWiki:
localurl
,
fullurl
,
canonicalurl
— variants that produce a URL based on a page name and a query string
lc
,
lcfirst
,
uc
,
ucfirst
— lower-casing and upper-casing functions
    There are a variety of other pre-defined parser functions; you can see the full list here:
https://www.mediawiki.org/wiki/Help:Magic_words#Parser_functions
    There are also some tag functions, including , and . and (and ) were already covered here . is a very useful tag, that prevents MediaWiki formatting from being applied to text. For instance, to display the following on a wiki page:
The way to do italics is with ''double apostrophes''.
    You could use this wikitext:
The way to do
''
italics
''
is with
''
double apostrophes
''
.

5  Content organization
Categories
    Categories are MediaWiki’s basic method of organizing information. On wikis that don’t use Semantic MediaWiki, categories are really the only way to tag information about pages. Categories, for that reason, have been used in a large variety of ways — you only have to look at the explosion of categories on Wikipedia to see that.On the English-language Wikipedia, there are at least 6 ways in which categories get used:
to establish the basic type of the page’s subject, e.g. “Space Shuttles”
to define further characteristics of a page’s subject, e.g. “Italian generals”
to note a larger topic to which this page’s subject relates, e.g. “Theosophy”
to tag temporary information about the page itself, e.g. “Proposed deletion as of September 20, 2012”
to serve as a container super-category for other categories, e.g. “Symphonies by composer”
to tag pages other than regular pages or categories, e.g. “Animal templates”
    There are better ways of tagging much of this information, which take less work and lead to less redundancy. In fact, Semantic MediaWiki, which we’ll get to in later chapters, was first thought up in part in order to remove the need for the profusion of categories on Wikipedia. Still, even with Semantic MediaWiki, categories play an important role.
    Let’s look at how categories are defined and used. Any content page in MediaWiki can be added to a category, including images and files, as well as category pages themselves. In all cases, adding a page to a category consists of just adding the

Similar Books

The Bear: A Novel

Claire Cameron

The Way We Die Now

Seamus O'Mahony