Bureaucrats, content-moderator, emailconfirmed, Administrators (Semantic MediaWiki), Curators (Semantic MediaWiki), Administrators, threadmoderator
85,404
edits
(sprucing up the discussion of variables) |
|||
Line 1: | Line 1: | ||
'''← [[Tardis:Help]]''' | '''← [[Tardis:Help]]''' | ||
This page is a tutorial for learning to work with the essential rules of wiki-formatted text, or "wikitext". Wikitext is designed to be as simple as possible so that an article may be quickly typed ''and'' styled without having to take a break to type out long HTML codes. The goal is to make it as easy as possible to channel your thoughts into writing the perfect article (or even a not-so-perfect | This page is a tutorial for learning to work with the essential rules of wiki-formatted text, or "wikitext". Wikitext is designed to be as simple as possible so that an article may be quickly typed ''and'' styled without having to take a break to type out long HTML codes. The goal is to make it as easy as possible to channel your thoughts into writing the perfect article (or even a not-so-perfect one). | ||
== Text formatting == | == Text formatting == | ||
Line 241: | Line 241: | ||
== Images and other media == | == Images and other media == | ||
'''See:''' [[Help: Image markup]] | :'''See:''' [[Help: Image markup]] | ||
== Tables == | == Tables == | ||
'''See:''' [[Help: Table markup]] | :'''See:''' [[Help: Table markup]] | ||
== Mathematical formulae == | |||
:'''See:''' [[Help: Math markup]] | |||
== Templates == | == Templates == | ||
A template is a pre-defined bit of coding that places the same text across multiple pages. It can be as simple as a little system message, such as [[:Template:Current]] to a fairly complicated bit of coding that automatically calculates dates based upon the name of an article, like [[:Template:Timeline]]. | |||
One of the types of template you will most come into contact with here on tardis is the "infobox" template. These save you a great deal of repetitive typing of similar information, such as is found on television story or novel pages. Just go to the [[Tardis:Templates|Templates page]] and scan down the list for the ones you need. Put <nowiki>{{template}}</nowiki> in your edit, replacing "template" with the name of the specific one you are using, such "Infobox CD". For infoboxes, you will need to fill in the variables accepted by the template, such as director, writer, or broadcast date. | |||
The actual writing of templates is a complicated subject, beyond the scope of this article. | |||
:'''See also:''' [[Help:Template]] | |||
'''See:''' [[Help: | |||
=== Magic words === | |||
Beyond the templates that we have created are templates that are inherent in the MediaWiki software. These are not fully listed anywhere on this wiki, and do not appear in [[:Category:Templates]]. A good place to start one's understanding of these type of templates is at [[Wikipedia:Help:Magic words]]. | |||
== Variables == | They are called "magic" because they do things with one simple word that conceals rather a lot of complicated coding. Most editors of wikis, even those very experienced with template coding, don't really understand the underlying code that makes them work. Hence, as was once remarked in ''[[Battlefield]]'', any sufficiently advanced technology is indistinguishable from magic. | ||
====Variables==== | |||
Some of the simplest magic words have to do with detecting dates and other numbers. Because they return values which are not constant, this type of magic word is called a ''variable''. | |||
{| class="grey" style="margin: auto;" | {| class="grey" style="margin: auto;" | ||
Line 282: | Line 292: | ||
| {{CURRENTTIME}} | | {{CURRENTTIME}} | ||
|- | |- | ||
| <tt><nowiki>{{NUMBEROFARTICLES}}</nowiki></tt> | | <tt><nowiki>{{NUMBEROFARTICLES}}</nowiki> (number of articles in main namespace containing a link and not a redirect)</tt> | ||
| {{NUMBEROFARTICLES}} | | {{NUMBEROFARTICLES}} | ||
|} | |} | ||
These are not variables in the sense of being "user definable". The user has no control over the content of the variable. The term ''variable'' has another wiki code meaning, particularly in templates. If one wishes to elicit a response from a user in a template, such as by requesting the input of a director's name on an infobox, one would use a variable such as {{{Director}}}. Note that in wiki syntax, a user-defined variable is indicated by three curly braces {{{variable}}}, not two. | |||
====Behavior switches==== | |||
Another type of magic word is the behavior switch. These are indicated by the format <nowiki>__BEHAVIORSWITCHNAME__</nowiki>. Note the syntax requires a one-word name in all caps enclosed in two underscores. No other variation will work. Here are some of the most common ones: | |||
*<tt><nowiki>__NOTOC__</nowiki></tt> (can appear anywhere in the wikitext; suppresses the table of contents) | |||
*<tt><nowiki>__FORCETOC__</nowiki></tt> (can appear anywhere in the wikitext; makes a table of contents appear in its normal position above the first header) | |||
*<tt><nowiki>__TOC__</nowiki></tt> (places a table of contents at the word's position) | |||
*<tt><nowiki>__NOEDITSECTION__</nowiki></tt> (hides the section edit links beside headings) | |||
*<tt><nowiki>__NEWSECTIONLINK__</nowiki></tt> (adds a "+" link for adding a new section on a non-"Talk" page) | |||
*<tt><nowiki>__NONEWSECTIONLINK__</nowiki></tt> (removes the "+" link on "Talk" pages) | |||
*<tt><nowiki>__NOGALLERY__</nowiki></tt> (on a category page, replaces thumbnails with normal links) | |||
*<tt><nowiki>__HIDDENCAT__</nowiki></tt> (on a category page, makes it a [[WP:HIDDENCAT|hidden category]]) | |||
*<tt><nowiki>__INDEX__</nowiki></tt> (tells search engines to index the page) | |||
*<tt><nowiki>__NOINDEX__</nowiki></tt> (tells search engines not to index the page) | |||
=====DEFAULTSORT and DISPLAYTITLE===== | |||
Additionally, there are two very important behavior switches that impact variables. They might be thought of as "variable behavior switches". | |||
*<tt><nowiki>{{DISPLAYTITLE:</nowiki>''title''<nowiki>}}</nowiki></tt> (changes the [[WP:DISPLAYTITLE|displayed form]] of the page title) | |||
*<tt><nowiki>{{DEFAULTSORT:</nowiki>''sortkey''<nowiki>}}</nowiki></tt> (sets a default category [[WP:SORTKEY|sort key]]) | |||
DEFAULTSORT is a particularly important magic word to understand, as it should be placed on every page you create, if the title of that page is a person's name, or an article that begins with an article, such as "a", "an" or "the". | |||
Thus, the articles [[Steven Moffat]] and [[The Girl in the Fireplace]], should have this notation at the bottom: | |||
<pre> | |||
{{DEFAULTSORT:Moffat, Steven}} | |||
{{DEFAULTSORT:Girl in the Fireplace, The}} | |||
</pre> | |||
This will automatically sort the article alphabetically in whatever categories it is placed into. | |||
== Suppressing markup == | == Suppressing markup == |
edits