User:Marcus/MediaWiki Quick Reference: Difference between revisions
Updated wishlist |
use subpage |
||
(26 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
This is a | This is a single-page reference guide for {{SITENAME}}. If you are not familiar with wikitext and markup languages, see the tutorial on [[Using the Wiki]]. | ||
= | <!-- Limit table of contents to top level headings. --> | ||
<div class="toclimit-2">__TOC__</div> | |||
== About this Wiki == | |||
{{SITENAME}} is powered by MediaWiki, the software used by Wikipedia. The main sources of documentation are: | |||
* [[wikipedia:Help:Contents|Wikipedia's help pages]] | |||
* [[metawikipedia:Help:Contents|WikiMedia's meta wiki]] | |||
* [[mw:Manual|The MediaWiki administrator's manual]] | |||
This reference guide was based on the public domain [http://www.mediawiki.org/wiki/Project:PD_help Project:PD help]. | |||
== Formatting == | |||
== Basic | === Basic Markup === | ||
{| class="wikitable" | {| class="wikitable" | ||
! Description | ! Description | ||
Line 43: | Line 44: | ||
| Escape wiki markup | | Escape wiki markup | ||
| <pre> | | <pre> | ||
<nowiki>no ''markup''</nowiki> | <nowiki>no '''''markup'''''</nowiki> | ||
</pre> | </pre> | ||
| | | | ||
<nowiki>no ''markup''</nowiki> | <nowiki>no '''''markup'''''</nowiki> | ||
|} | |} | ||
Some HTML tags are allowed by MediaWiki ([http://en.wikipedia.org/wiki/Help:HTML_in_wikitext#Permitted_HTML full list]). | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 78: | Line 57: | ||
! width=40% | You get | ! width=40% | You get | ||
|- | |- | ||
| | | Underline | ||
| <pre> | | <pre> | ||
<u>Underline</u> | |||
</pre> | </pre> | ||
| | | | ||
<u>Underline</u> | |||
|- | |- | ||
| | | Strikethrough | ||
| <pre> | | <pre> | ||
<del>Strikethrough</del> | |||
or | |||
<s>Strikethrough</s> | |||
</pre> | </pre> | ||
| | | | ||
<del>Strikethrough</del> | |||
or | |||
<s>Strikethrough</s> | |||
|- | |||
| Monospaced text | |||
| <pre> | |||
<code>Source code</code> | |||
or | |||
<tt>Teletype text</tt> | |||
| | </pre> | ||
| | |||
<code>Source code</code> | |||
or | |||
<tt>Teletype text</tt> | |||
|- | |- | ||
| | | Superscript | ||
| <pre> | | <pre> | ||
C<sup>2</sup> | |||
</pre> | </pre> | ||
| | | | ||
C<sup>2</sup> | |||
|- | |- | ||
| | | Subscript | ||
| | | <pre> | ||
<pre> | C<sub>2</sub> | ||
</pre> | </pre> | ||
| | | | ||
C<sub>2</sub> | |||
|- | |- | ||
| | | Size adjustments | ||
| <pre> | |||
<big>Larger text</big> | |||
<small>Smaller text</small> | |||
<small>Small text with <big>larger text</big> inside</small> | |||
<small><small>Really small text</small></small> | |||
</pre> | |||
| | | | ||
< | <big>Larger text</big> | ||
<small>Smaller text</small> | |||
<small>Small text with <big>larger text</big> inside</small> | |||
<small><small>Really small text</small></small> | |||
|- | |||
| Code | |||
| <pre> | |||
<code>code sample</code> | |||
</pre> | </pre> | ||
| | | | ||
<code>code sample</code> | |||
|- | |- | ||
| | | Old-school font styling | ||
{{note|This is deprecated, so use CSS styling instead.}} | |||
| <pre> | | <pre> | ||
<font color="green" size="4" face="serif">Big Green Serifs</font> | |||
</pre> | </pre> | ||
| | | | ||
<font color="green" size="4" face="serif">Big Green Serifs</font> | |||
|- | |- | ||
| | | CSS styling | ||
| | | <pre> | ||
<pre> | <span style="color:green; font-size:large; | ||
font-family:serif">Big Green Serifs</span> | |||
</pre> | </pre> | ||
| | | | ||
<span style="color:green; font-size:large; | |||
font-family:serif">Big Green Serifs</span> | |||
|- | |- | ||
| | | Abbreviation | ||
| <pre> | | <pre> | ||
<abbr title="World Taekwondo Federation">WTF</abbr> | |||
</pre> | </pre> | ||
| | | | ||
<abbr title="World Taekwondo Federation">WTF</abbr> | |||
|- | |||
| Cite an author | |||
{{note|This is often used with a blockquote, shown in [[#Other section formatting]].}} | |||
| <pre> | |||
<cite>John Doe</cite> | |||
</pre> | |||
| | | | ||
<cite>John Doe</cite> | |||
|- | |- | ||
| | | Highlight text that has been inserted into a document. | ||
| <pre> | | <pre> | ||
< | This text <ins>has</ins> been corrected. | ||
</pre> | </pre> | ||
| | | | ||
< | This text <ins>has</ins> been corrected. | ||
|- | |- | ||
| | | Refer to a variable in a computer program | ||
| <pre> | | <pre> | ||
The variable <var>foo</var> has not been initialised. | |||
</pre> | </pre> | ||
| | | | ||
The variable <var>foo</var> has not been initialised. | |||
|} | |} | ||
== | === Formatting Pitfalls === | ||
Beware the unexpected results shown below. | |||
{| class="wikitable" | {| class="wikitable" | ||
Line 269: | Line 189: | ||
! width=40% | You get | ! width=40% | You get | ||
|- | |- | ||
| | | Overlapping HTML is invalid | ||
{{note|Results will vary between browsers.}} | |||
| <pre> | | <pre> | ||
< | Avoid <b>overlapping <i>html</b> tags</i>. | ||
</pre> | </pre> | ||
| | | | ||
< | <nowiki>[invalid HTML output]</nowiki> | ||
|- | |- | ||
| | | Multiline HTML formatting | ||
| <pre> | | <pre> | ||
< | Avoid <b>multiline | ||
html</b> formatting tags. | |||
</pre> | </pre> | ||
| | | | ||
< | <nowiki>[invalid HTML output]</nowiki> | ||
|- | |- | ||
| | | Wiki markup spanning paragraphs | ||
| <pre> | | <pre> | ||
Avoid '''''multiline | |||
wiki''''' markup. | |||
</pre> | </pre> | ||
| | | | ||
Avoid '''''multiline | |||
wiki''''' markup. | |||
|- | |- | ||
| | | Multiline wiki markup | ||
| <pre> | | <pre> | ||
Avoid '''''multiline | |||
wiki''''' markup. | |||
</pre> | </pre> | ||
| | | | ||
Avoid '''''multiline | |||
wiki''''' markup. | |||
|- | |- | ||
| | | Overlapping wiki markup | ||
{{note|This is valid, but can be confusing.}} | |||
| <pre> | | <pre> | ||
Basic '''overlapping ''wiki''' markup'' works OK. | |||
</pre> | </pre> | ||
| | | | ||
Basic '''overlapping ''wiki''' markup'' works OK. | |||
|} | |||
=== Symbols === | |||
An HTML symbol entity is a sequence of characters that produces one particular character. For example, <code>&euro;</code> produces the Euro symbol "<code>€</code>" and <code>&trade;</code> produces trademark symbol "<code>™</code>". HTML symbol entities are allowed in MediaWiki and are sometimes used in advanced editing for two main reasons: to insert characters not normally available on keyboards and to prevent the parser from interpreting and displaying HTML tags and symbols: | |||
:<tt>&amp;euro;</tt> → '''<tt>&euro;</tt>''' | |||
:<tt>&lt;span style="color:green;">Green&lt;/span></tt> → '''<tt><span style="color:green;">Green</span></tt>''' | |||
The following is a list of characters that can be produced using HTML symbols. Hover any character to find out the symbol that produces it. Some symbols not available in the current font will appear as empty squares. | |||
|} | |||
== | |||
An HTML symbol entity is a sequence of characters that produces one particular character. For example, <code>&euro;</code> produces the Euro symbol "<code>€</code>" and <code>&trade;</code> produces trademark symbol "<code>™</code>". HTML symbol entities are allowed in MediaWiki and are sometimes used in advanced editing for two main reasons: to insert characters not normally available on keyboards and to prevent the parser from interpreting and displaying HTML tags and symbols: | |||
:<tt>&amp;euro;</tt> → '''<tt>&euro;</tt>''' | |||
:<tt>&lt;span style="color:green;">Green&lt;/span></tt> → '''<tt><span style="color:green;">Green</span></tt>''' | |||
The following is a list of characters that can be produced using HTML symbols. Hover any character to find out the symbol that produces it. Some symbols not available in the current font will appear as empty squares. | |||
{| class="wikitable" align=center width=100% | {| class="wikitable" align=center width=100% | ||
! colspan=32 | HTML Symbol Entities | ! colspan=32 | HTML Symbol Entities | ||
Line 635: | Line 507: | ||
|} | |} | ||
== Mathematical formulae == | === Mathematical formulae === | ||
Formulae can be written in TeX using <code><math></code> tags. See [[wikipedia:Help:Displaying a formula]] for details. | |||
{| class="wikitable" | |||
! Description | |||
! width=40% | You type | |||
! width=40% | You get | |||
{| | |||
!Description | |||
!You type | |||
!You get | |||
|- | |- | ||
| | | The equation of mass-energy equivalence | ||
|<pre> | | <pre> | ||
| | <math>E = mc^2 \,\!</math> | ||
</pre> | |||
| | |||
<math>E = mc^2 \,\!</math> | |||
|- | |- | ||
| | | The convolution theorem states that... | ||
{{ | | <pre> | ||
<math> \mathcal{F}\{f * g\} = k\cdot \mathcal{F}\{f\}\cdot \mathcal{F}\{g\}</math> | |||
|[[ | </pre> | ||
| | |||
<math> \mathcal{F}\{f * g\} = k\cdot \mathcal{F}\{f\}\cdot \mathcal{F}\{g\}</math> | |||
|} | |||
=== Signatures === | |||
In some situations you may want to sign your name or indicate when a change was made. You can do this easily using the tilde character (<code>~</code>) as shown below. This is particularly useful on [[#Talk pages|talk pages]]. | |||
{| class="wikitable" | |||
! Function | |||
! You type | |||
! Automatically susbstituted wiki code | |||
! You get | |||
|- | |- | ||
| | | Full signature (recommended) | ||
|<pre>[[ | | <pre>~~~~</pre> | ||
|[[ | | | ||
<code><nowiki>[[</nowiki>{{ns:2}}:Username|Username]] 12:34, 1 February 2008 (UTC)</code> | |||
| [[{{ns:2}}:Username|Username]] 12:34, 1 February 2008 (UTC) | |||
|- | |||
| Signature alone | |||
| <pre>~~~</pre> | |||
| | |||
<code><nowiki>[[</nowiki>{{ns:2}}:Username|Username]] </code> | |||
| [[{{ns:2}}:Username|Username]] | |||
|- | |- | ||
| | | Timestamp alone | ||
|<pre> | | <pre>~~~~~</pre> | ||
| <code>12:34, 1 February 2008 (UTC)</code> | |||
| 12:34, 1 February 2008 (UTC) | |||
|} | |||
== Layout == | |||
Section formatting can only be used at the beginning of a line. {{note}} Spaces at the start of a line are significant. | |||
=== Headings === | |||
Headings of different levels are created by surrounding the line with equal signs (=). | |||
<pre> | |||
== Level 2 == | |||
=== Level 3 === | |||
==== Level 4 ==== | |||
===== Level 5 ===== | |||
====== Level 6 ====== | |||
</pre> | </pre> | ||
[[ | {{note|Level 1 is automatically generated for the page title and is not appropriate within the body of articles.}} | ||
For each heading in the wiki article an HTML anchor is automatically created. That makes it possible to create [[#Links to section headings|links to section headings]]. An article with 4 or more headings automatically shows a table of contents. | |||
=== Paragraphs === | |||
MediaWiki generally ignores single line breaks and joins consecutive lines of text together. To start a new paragraph, leave an empty line. To create a wide paragraph break, leave two empty lines. You can force a line break inside a paragraph with the HTML tag <code><br /></code>. | |||
{| class="wikitable" | |||
! Description | |||
! width=40% | You type | |||
! width=40% | You get | |||
|- | |- | ||
| | | Single line breaks are ignored | ||
| <pre> | |||
|<pre> | This text is joined | ||
| | together as if it | ||
were a single line. | |||
</pre> | |||
| | |||
This text is joined | |||
together as if it | |||
were a single line. | |||
|- | |- | ||
| | | Empty lines define paragraphs | ||
{{note|Two empty lines give a larger paragraph break.}} | |||
| <pre> | |||
First paragraph. | |||
Second paragraph. | |||
The third paragraph will <br /> break in the middle. | |||
</pre> | |||
| | |||
First paragraph. | |||
Second paragraph. | |||
{{note| | |||
|< | |||
| | |||
The third paragraph will <br /> break in the middle. | |||
|} | |} | ||
=== | === Other section formatting === | ||
{| class="wikitable" | |||
! Description | |||
{| | ! width=40% | You type | ||
!Description | ! width=40% | You get | ||
!You type | |||
!You get | |||
|- | |- | ||
| | | Bullet list | ||
|<pre> | | | ||
[[ | <pre> | ||
* Start each line | |||
* with an [[Wikipedia:asterisk|asterisk]] (*). | |||
** More asterisks gives deeper | |||
*** and deeper levels. | |||
* Line breaks<br />don't break levels. | |||
*** But jumping levels creates empty space. | |||
Any other new line ends the list. | |||
</pre> | </pre> | ||
| | | | ||
* Start each line | |||
* with an [[Wikipedia:asterisk|asterisk]] (*). | |||
[[ | ** More asterisks gives deeper | ||
*** and deeper levels. | |||
* Line breaks<br />don't break levels. | |||
*** But jumping levels creates empty space. | |||
Any other new line ends the list. | |||
|- | |- | ||
| Numbered list | |||
|Numbered | |||
| | | | ||
<pre> | |||
[ | # Start each line | ||
[ | # with a [[Wikipedia:Number sign|number sign]] (#). | ||
## More number signs gives deeper | |||
### and deeper | |||
### levels. | |||
# Line breaks<br />don't break levels. | |||
### But jumping levels creates empty space. | |||
# Blank lines | |||
# end the list and start another. | |||
Any other new line also | |||
ends the list. | |||
</pre> | |||
| | |||
# Start each line | |||
# with a [[Wikipedia:Number sign|number sign]] (#). | |||
## More number signs gives deeper | |||
### and deeper | |||
### levels. | |||
# Line breaks<br />don't break levels. | |||
### But jumping levels creates empty space. | |||
# Blank lines | |||
# end the list and start another. | |||
Any other new line also | |||
ends the list. | |||
|- | |- | ||
| | | Definition list | ||
| <pre> | |||
;item 1 | |||
: definition 1 | |||
;item 2 | |||
: definition 2-1 | |||
: definition 2-2 | |||
</pre> | |||
| | |||
;item 1 | |||
: definition 1 | |||
;item 2 | |||
: definition 2-1 | |||
: definition 2-2 | |||
|- | |- | ||
| | | Mixture of different types of list | ||
| | |||
<pre> | |||
| | # one | ||
# two | |||
#* two point one | |||
#* two point two | |||
# three | |||
## three sub 1 | |||
### three sub 1 sub 1 | |||
## three sub 2 | |||
</pre> | |||
| | |||
# one | |||
# two | |||
#* two point one | |||
#* two point two | |||
# three | |||
## three sub 1 | |||
### three sub 1 sub 1 | |||
## three sub 2 | |||
|- | |- | ||
| | | Poetry | ||
| <pre> | |||
<poem> | |||
A programmer started to cuss, | |||
Because getting to sleep was a fuss. | |||
As he lay there in bed, | |||
Looping ’round in his head, | |||
Was: while(!asleep()) sheep++; | |||
-- <cite>Author unknown</cite> | |||
</poem> | |||
</pre> | |||
| | |||
<poem> | |||
A programmer started to cuss, | |||
Because getting to sleep was a fuss. | |||
As he lay there in bed, | |||
Looping ’round in his head, | |||
Was: while(!asleep()) sheep++; | |||
-- <cite>Author unknown</cite> | |||
</poem> | |||
|- | |- | ||
| | | Blockquotes | ||
| <pre> | |||
text above | |||
text above | |||
<blockquote>blockquote</blockquote> | |||
text below | |||
text below | |||
</pre> | |||
| | |||
text above | |||
text above | |||
<blockquote>blockquote</blockquote> | |||
text below | |||
text below | |||
|- | |- | ||
| | | Preformatted text | ||
{{note|This way of preformatting only applies to section formatting. Text formatting markup is still effective.}} | |||
| <pre> | |||
Start each line with a space. | |||
* Text is '''preformatted''' and | |||
character formatting is effective. | |||
</pre> | |||
| | |||
Start each line with a space. | |||
* Text is '''preformatted''' and | |||
character formatting is effective. | |||
|- | |- | ||
| | | Completely preformatted text | ||
| <pre> | |||
<pre> Text is '''preformatted''' and | |||
''markup'' '''''is''''' not effective.</pre> | |||
</pre> | |||
| | |||
<pre> Text is '''preformatted''' and | |||
''markup'' '''''is''''' not effective. | |||
</pre> | |||
''' | |||
|- | |- | ||
| Syntax Highlighting for code | |||
| <pre> | |||
<syntaxhighlight lang="cpp">#include <iostream> | |||
using namespace std; | |||
int main (int argc, char** argv) { | |||
cout << "Hello World!"; | |||
return 0; | |||
}</syntaxhighlight> | |||
</pre> | |||
| | | | ||
<syntaxhighlight lang="cpp">#include <iostream> | |||
using namespace std; | |||
int main (int argc, char** argv) { | |||
cout << "Hello World!"; | |||
return 0; | |||
}</syntaxhighlight> | |||
|- | |- | ||
| A useful error message for syntax higlighting | |||
{{note|When an invalid 'lang' is used, the error message lists the available languages. Also see [http://www.mediawiki.org/wiki/Extension:SyntaxHighlight_GeSHi#Supported_languages].}} | |||
| <pre> | |||
<syntaxhighlight lang="-"></syntaxhighlight> | |||
</pre> | |||
| | | | ||
<syntaxhighlight lang="-"></syntaxhighlight> | |||
|- | |- | ||
| Horizontal rule | |||
| <pre> | |||
Text above | |||
---- | |||
Text below | |||
</pre> | |||
| | | | ||
Text above | |||
| | ---- | ||
Text below | |||
|- | |||
| Old-school centered text | |||
{{note|This is deprecated, so use the css method instead.}} | |||
| <pre> | |||
text above<center>centered</center>text below | |||
</pre> | |||
| | | | ||
text above<center>centered</center>text below | |||
|- | |- | ||
| CSS method to center text | |||
| <pre> | |||
text above<div class="center" style="width:auto; | |||
margin-left:auto; margin-right:auto;">centered</div> | |||
text below | |||
</pre> | |||
| | | | ||
text above<div class="center" style="width:auto; | |||
| | margin-left:auto; margin-right:auto;">centered</div> | ||
text below | |||
|- | |||
| Comment | |||
| <pre> | |||
<!-- This is a comment --> | |||
Comments are only visible | |||
in the edit window. | |||
</pre> | |||
| | |||
<!-- This is a comment --> | |||
Comments are only visible | |||
in the edit window. | |||
|} | |} | ||
=== | == Links == | ||
The | |||
There are three sorts of links: | |||
# '''[[#Internal links|Internal links]]''' to other pages in the wiki. | |||
# '''[[#External links|External links]]''' to other websites. | |||
# '''[[#Interwiki links|Interwiki links]]''' to other websites registered to the wiki in advance. | |||
=== Internal links === | |||
To add an internal link, enclose the name of the page you want to link to in double square brackets. The first letter of the link is automatically capitalized and spaces are replaced with underscores. | |||
{{note|A red link indicates that the target page does not exist yet.}} | |||
{| | {| border="1" class="wikitable" | ||
! | !Description | ||
! | !You type | ||
!You get | |||
|- | |||
|An internal link | |||
|<pre>[[NottingHack]]</pre> | |||
|[[NottingHack]] | |||
|- | |||
|A [[metawikipedia:Help:Piped link|piped link]] | |||
|<pre>[[NottingHack|different text]]</pre> | |||
|[[NottingHack|different text]] | |||
|- | |- | ||
| | |Word-endings are 'blended' | ||
<pre> | |<pre> | ||
[[Help]]s | |||
[[Help]]ing | |||
[[Help]]ers | |||
[[Help]]anylettersyoulikehere | |||
[[Help]]<nowiki></nowiki>anylettersyoulikehere | |||
</pre> | </pre> | ||
| | | | ||
[[Help]]s | |||
[[Help]]ing | |||
[[Help]]ers | |||
[[Help]]anylettersyoulikehere | |||
[[Help]]<nowiki></nowiki>anylettersyoulikehere | |||
|- | |- | ||
| | |Link to an anchor on the current page | ||
<pre> | {{note|See [[#Links to section headings|links to section headings]].}} | ||
|<pre>[[#See also]]</pre> | |||
|[[#See also]] | |||
|- | |- | ||
| | |Link to an anchor from different text | ||
|<pre>[[#See also|different text]]</pre> | |||
|[[#See also|different text]] | |||
|- | |- | ||
| | |Link to the current page's table of contents | ||
| | |<pre>[[#toc|Contents]]</pre> | ||
</pre> | |[[#toc|Contents]] | ||
| | |||
|- | |- | ||
| | |Link to the top of the current page | ||
|<pre>[[#top|top]]</pre> | |||
|[[#top|top]] | |||
|- | |||
|Setting an internal link anchor | |||
{{note|Omit the "optional text" for invisible anchor.}} | |||
|<pre><div id="NameOfAnchorHere">optional text</div></pre> | |||
|<div id="NameOfAnchorHere">optional text</div> | |||
|- | |||
|Link to an anchor at another page | |||
|<pre>[[Help:Images#See also]]</pre> | |||
|[[Help:Images#See also]] | |||
|- | |- | ||
| | |Shortcut to hide a [[#Namespaces|namespace]] | ||
See [[#The pipe trick|the pipe trick]]. | |||
|<pre> | |||
[[Help:Contents|]] | |||
[[Help:Contents]] | |||
</pre> | |||
| | | | ||
[[Help:Contents|Contents]] | |||
[[Help:Contents]] | |||
|- | |- | ||
| | | [[#Redirects|Redirect]] | ||
|<pre>#REDIRECT [[Main Page]]</pre> | |||
| → [[Main Page]] | |||
|- | |- | ||
| | |Link to the current page's talk page | ||
|} | |<pre>[[{{TALKPAGENAME}}|Discussion]]</pre> | ||
</pre> | |[[{{TALKPAGENAME}}|Discussion]] | ||
| | |- | ||
|Link to the current page's edit page | |||
| | |<pre>[{{fullurl:{{PAGENAME}}|action=edit}} Edit]</pre> | ||
|[{{fullurl:{{PAGENAME}}|action=edit}} Edit] | |||
|- | |||
|Link to a [[#Subpages|subpage]] | |||
|<pre>[[/example]]</pre> | |||
|[[/example]] | |||
|- | |||
|Link to a subpage without the leading slash | |||
|<pre>[[/example/]]</pre> | |||
|[[/example/]] | |||
|- | |||
|Link to a [[#Categories|category page]] | |||
|<pre>[[:Category:Help]]</pre> | |||
|[[:Category:Help]] | |||
|- | |||
|Link to an [[#Images|image or a file]] | |||
|<pre>[[media:example.jpg]]</pre> | |||
|[[media:example.jpg]] | |||
|- | |- | ||
| | |Link to the user's user page | ||
|<pre>[[Special:MyPage]]</pre> | |||
|[[Special:MyPage]] | |||
|- | |- | ||
| | |Additional wiki markup is permitted in link titles | ||
| | |<pre>[[#top|'''<del>rich</del>''' ''link text'' here.]]</pre> | ||
|[[#top|'''<del>rich</del>''' ''link text'' here.]] | |||
|} | |} | ||
You can | ==== Links to section headings ==== | ||
You can link directly to headings within a wiki page. MediaWiki automatically creates an HTML anchor with the same name as the heading. | |||
{| | {| border="1" class="wikitable" | ||
! | !Description | ||
! | !You type | ||
!You get | |||
|- | |- | ||
|Links to section headings | |||
|<pre> | |||
[[#External links|Links]] | |||
[[#Table pitfalls!]] | |||
</pre> | |||
| | | | ||
[[#External links|Links]] | |||
[[#Table pitfalls!]] | |||
|} | |} | ||
{{note| If a heading is renamed then any links to that heading will be broken.}} | |||
=== External links === | |||
{| class="wikitable" | |||
!style="width:15%"|Description | |||
!style="width:45%"|You type | |||
!style="width:40%"|You get | |||
=== | |||
{| | |||
!style="width: | |||
!style="width: | |||
|- | |- | ||
| | |External link | ||
<pre> | |<pre>http://mediawiki.org</pre> | ||
|http://mediawiki.org | |||
|- | |- | ||
| | |External link with different label | ||
| | |<pre>[http://mediawiki.org MediaWiki]</pre> | ||
| | |[http://mediawiki.org MediaWiki] | ||
|- | |- | ||
| | |Numbered external link | ||
| | |<pre>[http://mediawiki.org]</pre> | ||
| | |[http://mediawiki.org] | ||
|- | |- | ||
| | |External links with file icons. | ||
See [[#External links icons|currently supported icons]]. | |||
| | |<pre> | ||
| | [http://en.wikipedia.org/wiki/.avi video]<br/> | ||
[http://en.wikipedia.org/wiki/.ogg sound]<br/> | |||
[http://en.wikipedia.org/wiki/.pdf document]<br/> | |||
</pre> | </pre> | ||
| | | | ||
[http://en.wikipedia.org/wiki/.avi video]<br/> | |||
[http://en.wikipedia.org/wiki/.ogg sound]<br/> | |||
[http://en.wikipedia.org/wiki/.pdf document]<br/> | |||
|- | |||
|External link to the same host | |||
|<pre>http://{{SERVERNAME}}/pagename</pre> | |||
|http://{{SERVERNAME}}/pagename | |||
|- | |- | ||
| | |External link to other host passing the pagename | ||
| | |<pre>http://google.com/search?q={{PAGENAMEE}}</pre> | ||
| | |http://google.com/search?q={{PAGENAMEE}} | ||
|- | |- | ||
| | |Mailto link | ||
| | |<pre>[mailto:info@example.org email me]</pre> | ||
| | |[mailto:info@example.org email me] | ||
|- | |- | ||
| | |Mailto named with subject line and body | ||
| | |<pre>[mailto:info@example.org?Subject=URL%20Encoded%20Subject&body=Body%20Text info]</pre> | ||
| | |[mailto:info@example.org?Subject=URL%20Encoded%20Subject&body=Body%20Text info] | ||
|- | |- | ||
|Additional wiki markup is permitted in link titles | |||
| | |<pre>[http://www.example.com/some/image.png Example '''<del>rich</del>''' ''link text'' here.]</pre> | ||
| | |[http://www.example.com/some/image.png Example '''<del>rich</del>''' ''link text'' here.] | ||
| | |||
|} | |} | ||
=== | === External link icons === | ||
{| class="wikitable" | |||
! Test link !! Icon !! Trigger | |||
{| | |||
! | |||
! | |||
|- | |- | ||
| | | [http://.] || [http://bits.wikimedia.org/skins-1.17/vector/images/external-link-ltr-icon.png external-link-ltr-icon.png] || <code>.external</code>, <code>http://</code>, <code>gopher://</code> | ||
< | |||
|- | |- | ||
| | | [https://.] || [http://bits.wikimedia.org/skins-1.17/vector/images/lock-icon.png lock-icon.png] || <code>https://</code> | ||
| | |||
|- | |- | ||
| | | [mailto:.] || [http://bits.wikimedia.org/skins-1.17/vector/images/mail-icon.png mail-icon.png] || <code>mailto:</code> | ||
| | |||
|- | |- | ||
| | | [news://.] || [http://bits.wikimedia.org/skins-1.17/vector/images/news-icon.png news-icon.png] || <code>news<nowiki/>://</code> | ||
| | |||
| | |||
</ | |||
|- | |- | ||
| | | [ftp://.] || [http://bits.wikimedia.org/skins-1.17/vector/images/file-icon.png file-icon.png] || <code>ftp://</code> | ||
| | |||
|- | |- | ||
| | | [irc://.] || [http://bits.wikimedia.org/skins-1.17/vector/images/talk-icon.png talk-icon.png] || <code>irc://</code> | ||
| | |- | ||
| [http://.ogg] || [http://bits.wikimedia.org/skins-1.17/vector/images/audio-icon.png audio-icon.png] || <code>.ogg</code>, <code>.mid</code>, <code>.midi</code>, <code>.mp3</code>, <code>.wav</code>, <code>.wma</code> | |||
|- | |||
| [http://.ogm] || [http://bits.wikimedia.org/skins-1.17/vector/images/video-icon.png video-icon.png] || <code>.ogm</code>, <code>.avi</code>, <code>.mpeg</code>, <code>.mpg</code> | |||
|- | |- | ||
| | | [http://.pdf] || [http://bits.wikimedia.org/skins-1.17/vector/images/document-icon.png document-icon.png] || <code>.pdf</code>, <code>.pdf#</code>, <code>.pdf?</code> | ||
| | |||
| | |||
|} | |} | ||
=== | ==== How to avoid auto-links ==== | ||
By default, when you write a URL as is, it will be transformed to an external link. To avoid that effect, put the URL between <code><nowiki></code> tags as in: | |||
<nowiki><nowiki>http://mediawiki.org</nowiki></nowiki> | |||
=== | === Interwiki links === | ||
Interwiki links are abbreviations for longer URLs. They can link to an external site almost as if they are linking to a page on {{SITENAME}}. The external website must be registered in advance on the [[{{ns:Special}}:Interwiki]] page. | |||
{| | {| border="1" class="wikitable" | ||
! | !Description | ||
! | !You type | ||
!You get | |||
|- | |- | ||
|An interwiki link to a <code>wikipedia</code> article. | |||
|<pre> | |||
[[wikipedia:Sunflower|big yellow flower]] | |||
</pre> | |||
| | | | ||
[[wikipedia:Sunflower|big yellow flower]] | |||
| | |||
|- | |- | ||
| | |A similar external link (without using an interwiki link). | ||
| | |<pre> | ||
[http://en.wikipedia.org/wiki/Sunflower big yellow flower] | |||
</pre> | </pre> | ||
| | | | ||
[http://en.wikipedia.org/wiki/Sunflower big yellow flower] | |||
|} | |} | ||
=== | === The pipe trick === | ||
The '''pipe trick''' is a quick way to abbreviate certain types of links while you are editing wiki text. Once you save the page, the abbreviations are substituted with the full versions of the links. Some examples are shown below and more details can be found in [[wikipedia:Help:Pipe trick]] and [[metawikipedia:Help:Piped link#Pipe trick]]. | |||
{| | {| border="1" class="wikitable" | ||
! | !Description | ||
! | !You type | ||
!Substitution | |||
!You get | |||
|- | |- | ||
|Page title with parentheses | |||
|<pre> | |||
[[top (Unix)|]] | |||
</pre> | |||
|<pre> | |||
[[top (Unix)|top]] | |||
</pre> | |||
| | | | ||
[[top (Unix)|top]] | |||
|- | |- | ||
| | |Page title with commas | ||
| | |<pre> | ||
| | [[top, unix|]] | ||
</pre> | |||
|<pre> | |||
[[top, unix|top]] | |||
</pre> | |||
| | |||
[[top, unix|top]] | |||
|- | |- | ||
| | |Page title with namespace | ||
| | |<pre> | ||
| | [[Help:Contents|]] | ||
| | </pre> | ||
|<pre> | |||
[[Help:Contents|Contents]] | |||
</pre> | </pre> | ||
| | | | ||
[[Help:Contents|Contents]] | |||
|- | |- | ||
| | |An interwiki link | ||
| | |<pre> | ||
| | [[wikipedia:top (Unix)|]] | ||
| | </pre> | ||
| | |<pre> | ||
[[wikipedia:top (Unix)|top]] | |||
| | </pre> | ||
| | | | ||
[[wikipedia:top (Unix)|top]] | |||
|} | |} | ||
== Tables == | |||
'''Tables''' can be added to wiki pages using either XHTML table elements directly, or using wikitext formatting to define the table. The benefit of wikitext is that it tends to be easier to see the table structure when editing. | |||
As a general rule, it is best to avoid using a table unless you need one. Table markup often complicates page editing. | |||
=== Wiki table markup summary === | |||
{{note|The following markers must each start on a new line.}} | |||
{| cellspacing="0" border="1" | {|cellpadding="5" cellspacing="0" border="1" width="60%" | ||
| | |||
<nowiki>{|</nowiki> | |||
| '''table start''' | |||
|- | |- | ||
| | | | ||
< | <nowiki>|+</nowiki> | ||
| table '''caption,''' ''optional;'' only between '''table start''' and the first '''table row''' | |||
| | |||
|- | |- | ||
| | | | ||
<nowiki>|-</nowiki> | |||
| '''table row,''' ''optional on the first row'' | |||
|- | |||
| | |||
<nowiki>!</nowiki> | |||
| '''table header''' cell, ''optional.'' | |||
|- | |||
| | |||
<nowiki>|</nowiki> | |||
| '''table data''' cell, ''required!'' | |||
|- | |- | ||
| | | | ||
<nowiki>|}</nowiki> | |||
| '''table end''' | |||
|} | |} | ||
These markers can also be used to write several consecutive table cells on the same line: | |||
{|cellpadding="5" cellspacing="0" border="1" width="60%" | |||
| | | | ||
<nowiki>!!</nowiki> | |||
| | | Start a consecutive '''table header''' cell. | ||
|- | |- | ||
| | | | ||
<nowiki>||</nowiki> | |||
| | | Start a consecutive '''table data''' cell. | ||
|} | |} | ||
=== | === Basic table examples === | ||
The following table lacks borders and good spacing but shows the simplest wiki markup table structure. | |||
{| cellspacing="0" border="1" | {| cellspacing="0" border="1" | ||
Line 1,239: | Line 1,186: | ||
| | | | ||
<pre> | <pre> | ||
{| | {| | ||
|Orange | |Orange | ||
|Apple | |Apple | ||
|- | |- | ||
|Bread | |Bread | ||
|Pie | |Pie | ||
|- | |||
|- | |||
|Butter | |Butter | ||
|Ice cream | |Ice cream | ||
|} | |} | ||
</pre> | </pre> | ||
| | | | ||
{| | {| | ||
|Orange | |Orange | ||
|Apple | |Apple | ||
|- | |- | ||
|Bread | |Bread | ||
|Pie | |Pie | ||
|- | |||
|- | |||
|Butter | |Butter | ||
|Ice cream | |Ice cream | ||
|} | |} | ||
|} | |} | ||
The cells in the same row can be listed on one line separated by <code>||</code> (two pipe symbols). If the text in the cell contains a line break, use <code><nowiki><br /></nowiki></code> instead. | |||
The | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
{| | |||
!|You type | |||
! | |||
|- | |- | ||
| | | | ||
<pre | <pre> | ||
{| | {| | ||
|Orange||Apple||more | |||
|- | |- | ||
|Bread||Pie||more | |||
|- | |- | ||
| | |Butter||Ice<br />cream||and<br />more | ||
| | |||
|} | |} | ||
</pre> | </pre> | ||
| | | | ||
{| | {| | ||
|Orange||Apple||more | |||
|- | |- | ||
|Bread||Pie||more | |||
|- | |- | ||
| | |Butter||Ice<br />cream||and<br />more | ||
| | |} | ||
|} | |} | ||
Extra spaces within cells in the wiki markup do not affect the actual table rendering: | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
|- | |- | ||
| | | | ||
<pre | <pre> | ||
{| | {| | ||
| Orange || Apple || more | |||
|- | |- | ||
| Bread || Pie || more | |||
|- | |- | ||
| | | Butter || Ice cream || and more | ||
| | |||
|} | |} | ||
</pre> | </pre> | ||
| | | | ||
{| | {| | ||
| Orange || Apple || more | |||
|- | |- | ||
| Bread || Pie || more | |||
|- | |- | ||
| | | Butter || Ice cream || and more | ||
| | |||
|} | |} | ||
|} | |} | ||
You can have longer text or more complex wiki syntax inside table cells: | |||
You can | |||
{| cellspacing="0" border="1" | {| cellspacing="0" border="1" | ||
Line 1,340: | Line 1,270: | ||
| | | | ||
<pre> | <pre> | ||
{| | {| | ||
|Lorem ipsum dolor sit amet, | |||
consetetur sadipscing elitr, | |||
sed diam nonumy eirmod tempor invidunt | |||
ut labore et dolore magna aliquyam erat, | |||
sed diam voluptua. | |||
At vero eos et accusam et justo duo dolores | |||
et ea rebum. Stet clita kasd gubergren, | |||
| | no sea takimata sanctus est Lorem ipsum | ||
dolor sit amet. | |||
| | |||
* Lorem ipsum dolor sit amet | |||
* consetetur sadipscing elitr | |||
* sed diam nonumy eirmod tempor invidunt | |||
|} | |} | ||
</pre> | </pre> | ||
| | | | ||
{| | {| | ||
|Lorem ipsum dolor sit amet, | |||
consetetur sadipscing elitr, | |||
sed diam nonumy eirmod tempor invidunt | |||
ut labore et dolore magna aliquyam erat, | |||
sed diam voluptua. | |||
At vero eos et accusam et justo duo dolores | |||
et ea rebum. Stet clita kasd gubergren, | |||
| | no sea takimata sanctus est Lorem ipsum | ||
dolor sit amet. | |||
| | |||
* Lorem ipsum dolor sit amet | |||
* consetetur sadipscing elitr | |||
* sed diam nonumy eirmod tempor invidunt | |||
|} | |} | ||
|} | |} | ||
==== | ==== Table headers ==== | ||
Table headers can be created by using "<code>!</code>" (exclamation mark) instead of "<code>|</code>" (pipe symbol). Headers usually show up bold and centered by default. | |||
{| cellspacing="0" border="1" | {| cellspacing="0" border="1" | ||
Line 1,380: | Line 1,314: | ||
|- | |- | ||
| | | | ||
<pre | <pre> | ||
{| | {| | ||
! Item | |||
! Amount | |||
! Cost | |||
|- | |||
|Orange | |Orange | ||
| | |10 | ||
|7.00 | |||
|- | |- | ||
|Bread | |Bread | ||
| | |4 | ||
|3.00 | |||
|- | |- | ||
|Butter | |Butter | ||
| | |1 | ||
|5.00 | |||
|- | |||
!Total | |||
| | |||
|15.00 | |||
|} | |} | ||
</pre> | </pre> | ||
| | | | ||
{| | {| | ||
! Item | |||
! Amount | |||
! Cost | |||
|- | |||
|Orange | |Orange | ||
| | |10 | ||
|7.00 | |||
|- | |- | ||
|Bread | |Bread | ||
| | |4 | ||
|3.00 | |||
|- | |- | ||
|Butter | |Butter | ||
| | |1 | ||
|5.00 | |||
|- | |||
!Total | |||
| | |||
|15.00 | |||
|} | |} | ||
|} | |} | ||
''' | ==== Table captions ==== | ||
A '''table caption''' can be added to any table as follows. | |||
{| cellspacing="0" border="1" | {| cellspacing="0" border="1" | ||
Line 1,412: | Line 1,369: | ||
|- | |- | ||
| | | | ||
<pre | <pre> | ||
{| | {| | ||
|+ | |+Food complements | ||
|- | |- | ||
|Orange | |Orange | ||
Line 1,427: | Line 1,384: | ||
</pre> | </pre> | ||
| | | | ||
{| | {| | ||
|+ | |+ Food complements | ||
|- | |- | ||
|Orange | |Orange | ||
Line 1,441: | Line 1,398: | ||
|} | |} | ||
=== | === Table attributes === | ||
The wikitext table markers can accept a space separated list of XHTML attributes. For example, this wikitext will start a row with green text: | |||
|- style="color:green;" | |||
In table cells and captions (<code>|</code> or <code>||</code>, <code>!</code> or <code>!!</code>, and <code>|+</code>) the attributes are separated from cell content with a single pipe character (<code>|</code>). | |||
|align="right"|This is a right-aligned table cell. | |||
For the authoritative source on XHTML attributes, see [http://www.w3.org/TR/REC-html40/struct/tables.html the W3C's HTML 4.01 Specification page on tables]. | |||
==== Attributes on entire tables ==== | |||
Placing attributes after the table start tag (<code>{|</code>) applies attributes to the entire table. | |||
{| cellspacing="0" border="1" | {| cellspacing="0" border="1" | ||
Line 1,451: | Line 1,417: | ||
|- | |- | ||
| | | | ||
<pre | <pre> | ||
{| border="1" | {| border="1" align="center" style="text-align:center;" | ||
|Orange | |||
|Apple | |||
|12,333.00 | |||
|- | |- | ||
|Bread | |||
|Pie | |||
|500.00 | |||
|- | |- | ||
|Butter | |||
|Ice cream | |||
|1.00 | |||
| | |||
| | |||
|} | |} | ||
</pre> | </pre> | ||
| | | | ||
{| border="1" | {| border="1" align="center" style="text-align:center;" | ||
|Orange | |||
|Apple | |||
|12,333.00 | |||
|- | |- | ||
|Bread | |||
|Pie | |||
|500.00 | |||
|- | |- | ||
|Butter | |||
|Ice cream | |||
|1.00 | |||
|} | |||
| | |||
| | |||
|} | |||
|} | |} | ||
=== | ==== Attributes on cells ==== | ||
You can put attributes on individual cells. For example, numbers may look better aligned right. | |||
== | {| cellspacing="0" border="1" | ||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
= | |- | ||
| | |||
<pre> | |||
{| border="1" | |||
= | |Orange | ||
|Apple | |||
|align="right" | 12,333.00 | |||
|- | |||
|Bread | |||
|Pie | |||
|align="right" | 500.00 | |||
|- | |- | ||
|Butter | |||
|Ice cream | |||
|align="right" | 1.00 | |||
|} | |} | ||
</pre> | |||
== | | | ||
{| border="1" | |||
|Orange | |||
|Apple | |||
|align="right"|12,333.00 | |||
|- | |||
|Bread | |||
|Pie | |||
|align="right"|500.00 | |||
|- | |- | ||
|Butter | |||
|Ice cream | |||
|align="right"|1.00 | |||
|} | |||
|} | |} | ||
You can also use cell attributes when you are listing multiple cells on a single line. Note that the cells are separated by <code>||</code>, and within each cell the attributes and cell contents are separated by <code>|</code>. | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
|- | |||
| | |||
<pre> | |||
{| border="1" | |||
| Orange || Apple || align="right" | 12,333.00 | |||
< | |- | ||
| Bread || Pie || align="right" | 500.00 | |||
|- | |||
| Butter || Ice cream || align="right" | 1.00 | |||
|} | |||
</pre> | |||
| | |||
{| border="1" | |||
| Orange || Apple || align="right" | 12,333.00 | |||
|- | |||
| Bread || Pie || align="right" | 500.00 | |||
|- | |||
| Butter || Ice cream || align="right" | 1.00 | |||
|} | |||
|} | |||
==== Attributes on rows ==== | |||
You can set attributes for individual rows. | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
< | |- | ||
| | |||
<pre> | |||
{| border="1" | |||
|Orange | |||
|Apple | |||
|align="right"|12,333.00 | |||
|- | |||
|Bread | |||
|Pie | |||
|align="right"|500.00 | |||
|- style="font-style:italic; color:green;" | |||
|Butter | |||
|Ice cream | |||
|align="right"|1.00 | |||
|} | |||
</pre> | |||
| | |||
{| border="1" | |||
|Orange | |||
|Apple | |||
|align="right"|12,333.00 | |||
|- | |||
|Bread | |||
|Pie | |||
|align="right"|500.00 | |||
|- style="font-style:italic; color:green;" | |||
|Butter | |||
|Ice cream | |||
|align="right"|1.00 | |||
|} | |||
|} | |||
==== One-pixel table borders ==== | |||
A one-pixel border can be achieved using [http://www.w3.org/TR/CSS2/tables.html#separated-borders separated borders] or the [http://www.w3.org/TR/CSS2/tables.html#collapsing-borders collapsing border] model. | |||
{|border="1" cellspacing="0" cellpadding="2" | |||
|- | |||
!|You type | |||
< | !width="200"|You get | ||
|- | |||
| | |||
<pre style="font-size: 80%"> | |||
{|style="border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000; padding: 0" | |||
|- | |||
!style="border-style: solid; border-width: 0 1px 1px 0"| Orange | |||
!style="border-style: solid; border-width: 0 0 1px 0"| Apple | |||
= | |||
|- | |- | ||
|style="border-style: solid; border-width: 0 1px 0 0"| Bread | |||
|style="border-style: solid; border-width: 0"| Pie | |||
|} | |||
{ | </pre> | ||
{ | | | ||
{ | {|style="margin: 0; border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000; padding: 0" | ||
|- | |||
!style="border-style: solid; border-width: 0 1px 1px 0"| Orange | |||
!style="border-style: solid; border-width: 0 0 1px 0"| Apple | |||
|- | |||
|style="border-style: solid; border-width: 0 1px 0 0"| Bread | |||
|style="border-style: solid; border-width: 0"| Pie | |||
|} | |||
|- | |||
| | |||
<pre style="font-size: 80%"> | |||
{|style="border-collapse: collapse; border-width: 1px; border-style: solid; border-color: #000" | |||
|- | |||
!style="border-style: solid; border-width: 1px"| Orange | |||
!style="border-style: solid; border-width: 1px"| Apple | |||
|- | |||
|style="border-style: solid; border-width: 1px"| Bread | |||
|style="border-style: solid; border-width: 1px"| Pie | |||
|} | |||
</pre> | |||
| | |||
{|style="border-collapse: collapse; border-width: 1px; border-style: solid; border-color: #000" | |||
|- | |||
!style="border-style: solid; border-width: 1px"| Orange | |||
!style="border-style: solid; border-width: 1px"| Apple | |||
|- | |||
|style="border-style: solid; border-width: 1px"| Bread | |||
|style="border-style: solid; border-width: 1px"| Pie | |||
|} | |||
|} | |} | ||
== | ==== HTML colspan and rowspan ==== | ||
You can use HTML <code>colspan</code> and <code>rowspan</code> attributes on cells for advanced layout. | |||
== | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
|- | |||
| | |||
<pre> | <pre> | ||
{| border="1" | |||
!colspan="6"|Shopping List | |||
|- | |||
|rowspan="2"|Bread & Butter | |||
|Pie | |||
|Buns | |||
|Danish | |||
|colspan="2"|Croissant | |||
|- | |||
|Cheese | |||
|colspan="2"|Ice cream | |||
|Butter | |||
|Yoghurt | |||
|} | |||
</pre> | </pre> | ||
| | |||
{| border="1" | |||
!colspan="6"|Shopping List | |||
|- | |||
|rowspan="2"|Bread & Butter | |||
|Pie | |||
|Buns | |||
|Danish | |||
|colspan="2"|Croissant | |||
|- | |||
|Cheese | |||
|colspan="2"|Ice cream | |||
|Butter | |||
|Yoghurt | |||
|} | |||
|} | |||
==== Table attributes with CSS styles ==== | |||
CSS style attributes can be added to tables with or without other HTML attributes. | |||
{| cellspacing="0" border="1" | |||
< | !style="width:50%"|You type | ||
File:Example.jpg | !style="width:50%"|You get | ||
File:Example.jpg | |- | ||
File:Example.jpg | | | ||
File:Example.jpg | <pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word; word-break:break-all;"> | ||
File:Example.jpg | {| style="color:green; background-color:#ffffcc;" cellpadding="10" cellspacing="0" border="1" | ||
File:Example.jpg | |Orange | ||
File:Example.jpg | |Apple | ||
|- | |||
|Bread | |||
|Pie | |||
|- | |||
|Butter | |||
|Ice cream | |||
|} | |||
</pre> | |||
| | |||
{| style="color:green; background-color:#ffffcc;" cellpadding="10" cellspacing="0" border="1" | |||
|Orange | |||
|Apple | |||
|- | |||
|Bread | |||
|Pie | |||
|- | |||
|Butter | |||
|Ice cream | |||
|} | |||
|} | |||
Attributes can be added to the caption and headers as follows. | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
|- | |||
| | |||
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word; word-break:break-all;"> | |||
{| border="1" cellpadding="20" cellspacing="0" | |||
|+ align="bottom" style="color:#e76700;" |''Food complements'' | |||
|- | |||
|Orange | |||
|Apple | |||
|- | |||
|Bread | |||
|Pie | |||
|- | |||
|Butter | |||
|Ice cream | |||
|} | |||
</pre> | |||
| | |||
{| border="1" cellpadding="20" cellspacing="0" | |||
|+ align="bottom" style="color:#e76700;" |''Food complements'' | |||
|- | |||
|Orange | |||
|Apple | |||
|- | |||
|Bread | |||
|Pie | |||
|- | |||
|Butter | |||
|Ice cream | |||
|} | |||
|} | |||
==== Accessibility of table header cells ==== | |||
Table header cells do not explicitly specify which table data cells they apply to (those on their right on the same row, or those below them on the same column). When the table is displayed in a visual 2D environment, this is usually obvious. However when tables are rendered on non-visual medias, you can help the browser to determine which table header cell applies to the description of any selected cell (in order to repeat its content in some accessibility helper) using a scope="row" or scope="col" attribute on table header cells. In most cases with simple tables, you'll use scope="col" on all header cells of the first row, and scope="row" on the first cell of the following rows: | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
|- | |||
| | |||
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word; word-break:break-all;"> | |||
{| border="1" cellspacing="0" cellpadding="2" | |||
|- | |||
!scope="col"| Item | |||
!scope="col"| Quantity | |||
!scope="col"| Price | |||
|- | |||
!scope="row"| Bread | |||
| 0.3 kg | |||
| $0.65 | |||
|- | |||
!scope="row"| Butter | |||
| 0.125 kg | |||
| $1.25 | |||
|- | |||
!scope="row" colspan="2"| Total | |||
| $1.90 | |||
|} | |||
</pre> | |||
| | |||
{| border="1" cellspacing="0" cellpadding="2" | |||
|- | |||
!scope="col"| Item | |||
!scope="col"| Quantity | |||
!scope="col"| Price | |||
|- | |||
!scope="row"| Bread | |||
| 0.3 kg | |||
| $0.65 | |||
|- | |||
!scope="row"| Butter | |||
| 0.125 kg | |||
| $1.25 | |||
|- | |||
!scope="row" colspan="2"| Total | |||
| $1.90 | |||
|} | |||
|} | |||
=== Sortable tables === | |||
To make a table sortable add <code>class="sortable"</code> as shown below. | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
|- | |||
| | |||
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word; word-break:break-all;"> | |||
{| class="wikitable sortable" | |||
|+Sortable table | |||
|- | |||
! Letter !! Number !! Title | |||
|- | |||
| c || 1 || Five | |||
|- | |||
| b || 3 || rows | |||
|- | |||
| e || 5 || of | |||
|- | |||
| d || 2 || text | |||
|- | |||
| a || 0 || here. | |||
|} | |||
</pre> | |||
| | |||
{| class="wikitable sortable" | |||
|+Sortable table | |||
|- | |||
! Letter !! Number !! Title | |||
|- | |||
| c || 1 || Five | |||
|- | |||
| b || 3 || rows | |||
|- | |||
| e || 5 || of | |||
|- | |||
| d || 2 || text | |||
|- | |||
| a || 0 || here. | |||
|} | |||
|} | |||
It is also possible to make some columns sortable and others non-sortable: | |||
{| cellspacing="0" border="1" | |||
!style="width:50%"|You type | |||
!style="width:50%"|You get | |||
|- | |||
| | |||
<pre style="white-space:-moz-pre-wrap; white-space:-pre-wrap; white-space:-o-pre-wrap; white-space:pre-wrap; word-wrap:break-word; word-break:break-all;"> | |||
{| class="wikitable sortable" | |||
|+Sortable table | |||
|- | |||
! Letter !! class="unsortable"|Number !! Title | |||
|- | |||
| c || 1 || Five | |||
|- | |||
| b || 3 || rows | |||
|- | |||
| e || 5 || of | |||
|- | |||
| d || 2 || text | |||
|- | |||
| a || 0 || here. | |||
|} | |||
</pre> | |||
| | |||
{| class="wikitable sortable" | |||
|+Sortable table | |||
|- | |||
! Letter !! class="unsortable"|Number !! Title | |||
|- | |||
| c || 1 || Five | |||
|- | |||
| b || 3 || rows | |||
|- | |||
| e || 5 || of | |||
|- | |||
| d || 2 || text | |||
|- | |||
| a || 0 || here. | |||
|} | |||
|} | |||
=== Table pitfalls! <!--Note: the title of this section is used to demonstrate "Links to section headings". -->=== | |||
If you start a cell on a new line with a negative number with a minus sign (or a parameter that evaluates to a negative number), your table can get broken, because the characters <code>|-</code> will be parsed as the wiki markup for table row, not table cell. To avoid this, insert a space before the value (<code>| -6</code>) or use in-line cell markup (<code>|| -6</code>). | |||
== Images == | |||
{{note|Images must be uploaded to the wiki before they can be used.}} | |||
=== Supported media types for images === | |||
The following file formats are supported on {{SITENAME}}: | |||
* '''.jpg''' or '''.jpeg''' : bitmap image compressed in the standard JPEG format (this lossy format is most suitable for photographs). | |||
* '''.png''' : bitmap image in the ''Portable Network Graphics'' format (specified by the ''W3 Consortium''). | |||
* '''.gif''' : bitmap image in the legacy ''Graphics Interchange Format''. | |||
* '''.svg''' : scalable image in the ''Scalable Vector Graphics'' format (specified by the ''W3 Consortium''). | |||
=== Uploading an image === | |||
# In the sidebar, under “toolbox”, click “Upload file.” | |||
# Select the “Source filename” | |||
# You can fill in the optional “Summary” text. {{note}} This is a plain text summary, not wikitext. | |||
After you upload a file, you will be redirected to the “file description page”. You should edit this page to provide more information about the file. For example, you should explain where you got the file from, and what its copyright status is. | |||
=== Displaying an image === | |||
The wikitext to display an image is: | |||
<nowiki>[[</nowiki>File:''filename.extension''|''options''|''caption'']] | |||
The ''options'' can be given in any order separated by pipes ('''|'''): | |||
; <code>border</code> | |||
: Adds a very thin border around the image. | |||
; <code>frame</code>, <code>frameless</code>, <code>thumb</code> or <code>thumbnail</code> | |||
: Controls how the image is formatted and embedded in the rest of the page. See the [[#Image dimensions and borders|examples of image formats]]. | |||
; <code>''{width}''x''{height}''px</code> | |||
: Resizes the image to fit inside a maximum ''{width}'' and ''{height}'' in pixels. See the [[#Image dimensions and borders|examples of image resizing]]. {{note|The image will always retain its aspect ratio.}} | |||
; <code>''{width}''px</code> | |||
: Resizes the image using a maximum width in pixels. | |||
; <code>x''{height}''px</code> | |||
: Resizes the image using maximum height in pixels. | |||
; <code>upright</code> | |||
: Uses a resizing algorithm suitable for images in portrait orientation rather than landscape. | |||
; <code>left</code>, <code>right</code>, <code>center</code>, or <code>none</code> | |||
: Controls the [[#Horizontal alignment|horizontal alignment]] (and inline/block or floating styles) of the image within a text (no default value). | |||
; <code>baseline</code>, <code>sub</code>, <code>super</code>, <code>top</code>, <code>text-top</code>, <code>middle</code>, <code>bottom</code>, or <code>text-bottom</code> | |||
: Controls the [[#Vertical alignment|vertical alignment]] of a non-floating inline image with the text before or after the image, and in the same block (the default vertical alignment is <code>middle</code>). | |||
; <code>link=''{target}''</code> | |||
: Allows to change the target of the generated link associated with the image. See [[#Altering the default link target|Altering the default link target]]. {{note|<code>link</code> does '''not''' work with <code>thumb</code>, <code>thumbnail</code> or <code>frame</code>.}} | |||
; <code>alt=''{alternative text}''</code> | |||
: Defines the alternative text (maps to the [http://www.w3.org/TR/html401/struct/objects.html#h-13.8 HTML <code>alt="..."</code> attribute]). | |||
; <code>page=''{number}''</code> | |||
: Renders the specified page number (only applicable when showing a .djvu or .pdf file). | |||
If a parameter does not match any of the other possibilities, it is assumed to be the caption text. Caption text is shown below the image in '''thumb''' and '''frame''' formats, or as mouseover text in '''border''' and '''frameless''' formats or when the format is omitted. Caption text displayed in the '''thumb''' and '''frame''' formats may contain wiki links and other formatting. In the other options, wiki-formatting will not work. If no caption text is supplied, a caption is automatically created showing the file name. To completely remove the caption, set it to <code><nowiki><span title=""></span></nowiki></code>. | |||
==== Image dimensions and borders ==== | |||
The effect of the size parameters depend on how the image is formatted, but images will always retain their aspect ratio. When the format is not specified the image can be reduced or enlarged to any size. An image with the <code>frame</code> format always ignores the size specification and the original image will be reduced if it exceeds a maximum size. The size of an image with the <code>thumb</code> format can be reduced, but can not be enlarged beyond the original image size unless it is a scalable media type. | |||
In the examples below, the original size of the image is 400 × 267 pixels. | |||
{|class="wikitable" | |||
|- | |||
! Format | |||
! You type | |||
! You get | |||
{{Help:Images/size|frame=}} | |||
{{Help:Images/size|frame=border}} | |||
{{Help:Images/size|frame=frame|note=The size parameters have no effect when using the <code>frame</code> format.}} | |||
{{Help:Images/size|frame=thumb|note=A <code>thumb</code> image cannot be enlarged beyond the size of the original image.}} | |||
{{Help:Images/size|frame=frameless|note=A <code>frameless</code> image cannot be enlarged beyond the size of the original image.}} | |||
|} | |||
==== Horizontal alignment ==== | |||
Note that when using the <code>frame</code> or <code>thumb[nail]</code> formats, the default horizontal alignment will be <code>right</code>. | |||
{|class="wikitable" | |||
|- | |||
!Description | |||
!You type | |||
!You get | |||
<!-- The character sequence   is used below to insert spaces that would otherwise be stripped off the template parameter --> | |||
{{Help:Images/frame|2=100px|frame=|ex='''no horizontal alignment specified''', or default alignment|inline=yes|float=no|textbefore=text before |textafter= text after}} | |||
{{Help:Images/frame|2=100px|frame=none|ex=specify horizontal alignment as: '''none'''|inline=no|float=no|textbefore=text before |textafter= text after}} | |||
{{Help:Images/frame|2=100px|frame=center|ex=specify horizontal alignment as: '''center'''|inline=no|float=no|textbefore=text before |textafter= text after}} | |||
{{Help:Images/frame|2=100px|frame=left|ex=specify horizontal alignment as: '''left'''|inline=no|float=yes|textbefore=text before |textafter= text after}} | |||
{{Help:Images/frame|2=100px|frame=right|ex=specify horizontal alignment as: '''right'''|inline=no|float=yes|textbefore=text before |textafter= text after}} | |||
|} | |||
==== Vertical alignment ==== | |||
The vertical alignment options take effect only if the image is displayed as an inline element and is not floating. They alter the way the inlined image will be vertically aligned with the text present in the same block before and/or after this image on the same row. Note that the displayed line of text where inline images are inserted (and the lines of text displayed after the current one) may be moved down. The line spacing will increase, just as may occur with spans of text with variable font sizes to allow the image height to be fully displayed with this alignment constraint. | |||
To show the alignment result more clearly in this example, the text spans are overlined and underlined, the line-height is increased and emphasized with a yellow background and grey border: | |||
<blockquote> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''top:''' [[File:Example.jpg|20px|top]] [[File:Example.jpg|40px|top]] [[File:Example.jpg|40px|border|top]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''text-top:''' [[File:Example.jpg|20px|text-top]] [[File:Example.jpg|40px|text-top]] [[File:Example.jpg|40px|border|text-top]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
<sup>'''super:'''</sup> [[File:Example.jpg|20px|super]] [[File:Example.jpg|40px|super]] [[File:Example.jpg|40px|border|super]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''baseline:''' [[File:Example.jpg|20px|baseline]] [[File:Example.jpg|40px|baseline]] [[File:Example.jpg|40px|border|baseline]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
<sub>'''sub:'''</sub> [[File:Example.jpg|20px|sub]] [[File:Example.jpg|40px|sub]] [[File:Example.jpg|40px|border|sub]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''default:''' [[File:Example.jpg|20px]] [[File:Example.jpg|40px]] [[File:Example.jpg|40px|border]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''middle:''' [[File:Example.jpg|20px|middle]] [[File:Example.jpg|40px|middle]] [[File:Example.jpg|40px|border|middle]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''text-bottom:''' [[File:Example.jpg|20px|text-bottom]] [[File:Example.jpg|40px|text-bottom]] [[File:Example.jpg|40px|border|text-bottom]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''bottom:''' [[File:Example.jpg|20px|bottom]] [[File:Example.jpg|40px|bottom]] [[File:Example.jpg|40px|border|bottom]] | |||
<del>text</del></u></span></p> | |||
<div class="mw-collapsible mw-collapsed"><div class="mw-collapsible-toggle toccolours" style="float:none;text-align:center">'''Source code for the example above'''</div> | |||
<div class="mw-collapsible-content" style="background:#fefefe;border:1px solid #AAA"> | |||
<source lang="html4strict" enclose="div"> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''top:''' [[File:Example.jpg|20px|top]] [[File:Example.jpg|40px|top]] [[File:Example.jpg|40px|border|top]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''text-top:''' [[File:Example.jpg|20px|text-top]] [[File:Example.jpg|40px|text-top]] [[File:Example.jpg|40px|border|text-top]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
<sup>super:</sup> [[File:Example.jpg|20px|super]] [[File:Example.jpg|40px|super]] [[File:Example.jpg|40px|border|super]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''baseline:''' [[File:Example.jpg|20px|baseline]] [[File:Example.jpg|40px|baseline]] [[File:Example.jpg|40px|border|baseline]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
<sub>'''sub:'''</sub> [[File:Example.jpg|20px|sub]] [[File:Example.jpg|40px|sub]] [[File:Example.jpg|40px|border|sub]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''default:''' [[File:Example.jpg|20px]][[File:Example.jpg|40px]] [[File:Example.jpg|40px|border]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''middle:''' [[File:Example.jpg|20px|middle]] [[File:Example.jpg|40px|middle]] [[File:Example.jpg|40px|border|middle]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''text-bottom:''' [[File:Example.jpg|20px|text-bottom]] [[File:Example.jpg|40px|text-bottom]] [[File:Example.jpg|40px|border|text-bottom]] | |||
<del>text</del></u></span></p> | |||
<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> | |||
<span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> | |||
'''bottom:'' [[File:Example.jpg|20px|bottom]] [[File:Example.jpg|40px|bottom]] [[File:Example.jpg|40px|border|bottom]] | |||
<del>text</del></u></span></p> | |||
</source></div></div> | |||
</blockquote> | |||
==== Stopping the text flow ==== | |||
On occasion it is desirable to stop text (or other inline non-floating images) from flowing around a floating image. Depending on the web browser's screen resolution and such, text flow on the right side of an image may cause a section header (for instance, <nowiki>== My Header ==</nowiki>) to appear to the right of the image, instead of below it, as a user may expect. The text flow can be stopped by placing '''<nowiki><br style="clear: both" /></nowiki>''' before the text that should start below the floating image. | |||
All images displayed as blocks (including non-floating '''center'''ed images, '''left'''- or '''right'''-floating images, as well as '''framed''' or '''thumbnail'''ed floating images) are implicitly breaking the surrounding lines of text (terminating the current block of text before the image, and creating a new paragraph for the text after them). They will then stack vertically along their left or right alignment margin (or along the center line between these margins for '''center'''ed images). | |||
==== Altering the link target ==== | |||
The table below shows how to alter or remove the link target associated with an image. {{note}}The link attribute '''does not work with''' <code>thumb</code> '''or''' <code>frame</code> formats. | |||
{|class="wikitable plainlinks" | |||
|- | |||
!Description | |||
!You type | |||
!You get | |||
{{Help:Images/frame|2=link=Main Page|ex=internal link}} | |||
{{Help:Images/frame|2=link=http://wikipedia.org|ex=external link}} | |||
{{Help:Images/frame|2=link=|ex=no link (external or file page)}} | |||
|} | |||
=== Displaying an image gallery === | |||
It's easy to make a gallery of thumbnails with the <code><nowiki><gallery></nowiki></code> tag: | |||
<nowiki><gallery></nowiki> | |||
Image:file_name.ext|caption | |||
Image:file_name.ext|caption | |||
{...} | |||
</gallery> | |||
Note that the image code is not enclosed in quare brackets inside gallery tags. Captions are optional, and may contain wiki links or other formatting. For example: | |||
<nowiki><gallery></nowiki> | |||
File:Example.jpg|Item 1 | |||
File:Example.jpg|a link to <nowiki>[[</nowiki>Help:Contents]] | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg| <nowiki>''italic caption''</nowiki> | |||
File:Example.jpg|on page "<nowiki>{{</nowiki>PAGENAME}}" | |||
</gallery> | |||
Is displayed as: | |||
<gallery> | |||
File:Example.jpg|Item 1 | |||
File:Example.jpg|a link to [[Help:Contents]] | |||
File:Example.jpg | |||
File:Example.jpg | File:Example.jpg | ||
File:Example.jpg | File:Example.jpg|''italic caption'' | ||
File:Example.jpg | File:Example.jpg|on page "{{PAGENAME}}" | ||
</gallery> | </gallery> | ||
=== Linking to an image without displaying it === | ==== Optional gallery attributes ==== | ||
The gallery tag itself takes several additional parameters, specified as attribute name-value pairs: | |||
==== Link to description page ==== | |||
If you put a colon (<code>:</code>) before <code>{{ns:image}}:</code>, the image will not be embedded and the link will lead to the description page of the file. | <pre><gallery {parameters}> | ||
{images} | |||
</gallery></pre> | |||
* <code>caption={caption}</code>: A caption for the gallery. | |||
* <code>widths={width}px</code>: The maximum width for the images. Note the plural (width'''''s''''') | |||
* <code>heights={heights}px</code>: The maximum height for the images. | |||
* <code>perrow={integer}</code>: The number of images per row. | |||
* <code>showfilename={y or n}</code>: Show the filenames in the image captions. | |||
Example wikitext: | |||
<pre> | |||
<gallery widths=60px heights=60px perrow=7 caption="sunflowers are groovy"> | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
</gallery> | |||
</pre> | |||
Result: | |||
<gallery widths=60px heights=60px perrow=7 caption="sunflowers are groovy"> | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
File:Example.jpg | |||
</gallery> | |||
=== Linking to an image without displaying it === | |||
==== Link to the description page ==== | |||
If you put a colon (<code>:</code>) before <code>{{ns:image}}:</code>, the image will not be embedded and the link will lead to the description page of the file. | |||
{| class="wikitable" | |||
! Description | |||
! width=40% | You type | |||
! width=40% | You get | |||
|- | |||
| Link to the description page of the file | |||
| <pre> | |||
<nowiki>[[</nowiki>:{{ns:image}}:Example.jpg]] | |||
</pre> | |||
| | |||
[[:{{ns:image}}:Example.jpg]] | |||
|- | |||
| Link to the description page with a custom title. | |||
| <pre> | |||
<nowiki>[[</nowiki>:{{ns:image}}:Example.jpg|Sunflowers]]</pre> | |||
| | |||
[[:{{ns:image}}:Example.jpg|Sunflowers]] | |||
|} | |||
==== Link directly to the media file ==== | |||
You can use the pseudo-namespace “{{ns:media}}” to link directly to a file without displaying it, bypassing the description page. | |||
{| class="wikitable" | |||
! Description | |||
! width=40% | You type | |||
! width=40% | You get | |||
|- | |||
| Link directly to a file. | |||
| <pre> | |||
<nowiki>[[</nowiki>{{ns:media}}:Example.jpg]] | |||
</pre> | |||
| | |||
[[{{ns:media}}:Example.jpg]] | |||
|- | |||
| Link directly to a file, with a custom title. | |||
| <pre> | |||
<nowiki>[[</nowiki>{{ns:media}}:Example.jpg|Sunflowers]] | |||
</pre> | |||
| | |||
[[{{ns:media}}:Example.jpg|Sunflowers]] | |||
|- | |||
| link to a potential file, even if it doesn't exist. | |||
| <pre> | |||
<nowiki>[[</nowiki>{{#special:Filepath}}/Example.jpg]] | |||
</pre> | |||
| | |||
[[{{#special:Filepath}}/Example.jpg]] | |||
|- | |||
| Generate an external URL to the file | |||
| <pre> | |||
<nowiki>{{</nowiki>FILEPATH:Example.jpg<nowiki>}}</nowiki> | |||
</pre> | |||
| | |||
{{FILEPATH:Example.jpg}} | |||
|} | |||
=== Displaying images from other websites === | |||
Currently it is not possible to embed images from other websites into {{SITENAME}}. Links are displayed instead. External image embedding could be enabled using [[mw:Manual:$wgAllowExternalImages]]. | |||
{| class="wikitable" | |||
! Description | |||
! width=40% | You type | |||
! width=40% | You get | |||
|- | |||
| Link or embed an image from another website | |||
| <pre> | |||
http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png | |||
</pre> | |||
| | |||
http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png | |||
|} | |||
== Widgets == | |||
MediaWiki widgets allow you to embed [[wikipedia:Web widget|web widgets]] into a wiki page. Each widget has its own documentation, which can be found in the [[Special:AllPages/Widget:|list of available widgets]]. | |||
== Namespaces == | |||
Pages in MediaWiki are partitioned into <nowiki>'</nowiki>'''namespaces'''', which indicate the purpose of the pages at a high level. Namespaces are specified in page titles by prefixing the page name with "<code>namespace:</code>". For example, the prefix "<code>{{NAMESPACE}}:</code>" in this page's title ("{{FULLPAGENAME}}") indicates that this page is in the {{NAMESPACE}} namespace. | |||
{{note|Colons and prefixes can also appear in page titles ''without'' indicating a namespace: The page [[Foo:{{PAGENAME}}]] is a page located in the Main namespace, because the namespace "Foo" does not exist. Similarly the page [[{{NAMESPACE}}:Foo:{{PAGENAME}}]] is in the "{{NAMESPACE}}" namespace.}} | |||
=== Standard namespaces === | |||
These are the namespaces that exist on {{SITENAME}}. Pages in some namespaces have special properties. | |||
{| class="wikitable" | |||
! Namespace | |||
! Purpose and special properties | |||
|- | |||
| {{ns:-2}} | |||
| An alias used to link directly to media files. | |||
|- style="border-top:1px solid #666" | |||
| {{ns:-1}} | |||
| Used to group [[Special:SpecialPages|special pages]], reports and interfaces that are generated 'on demand' by MediaWiki and which are not directly editable. | |||
|- | |||
| Main | |||
| This namespace typically contains the bulk of the content pages in a wiki. It has no special properties. | |||
|- | |||
| {{ns:1}} | |||
| Used for discussion attached to the main namespace. It has no special properties. | |||
|- | |||
| {{ns:2}} | |||
| Each user has a corresponding page in the {{ns:2}} namespace, which is linked to from edit histories, watchlists, recent changes, etc; wherever an individual user is uniquely identified. This page, and subpages of it, can be used by users to record information about themselves or to test and draft new content. | |||
|- | |||
| {{ns:3}} | |||
| A discussion space associated with the {{ns:2}} namespace, mainly used to leave messages for particular users or inform them of discussions that may be of interest to them. | |||
|- | |||
| {{ns:4}} | |||
| Normally used for content pages that document the operation and development of the wiki. It has no special properties. | |||
|- | |||
| {{ns:5}} | |||
| Normally used for discussions related to the associated content pages. It has no special properties. | |||
|- | |||
| {{ns:6}} | |||
| Used to store metadata for images, videos, sound files and other media accessed via the {{ns:-2}} namespace. Each file has a corresponding page in the {{ns:6}} namespace which is often used to hold licensing data. Linking ''directly'' to a page in this namespace instead includes the media file inline in the page. See [[#Images]] for details of the link syntax. There is an alias "Image" for the {{ns:6}} namespace. | |||
|- | |||
| {{ns:7}} | |||
| Normally used for discussion of the media files. It has no special properties. | |||
|- | |||
| {{ns:8}} | |||
| Used to hold system messages and other important content. | |||
|- | |||
| {{ns:9}} | |||
| A talk namespace that is normally used for discussions related to the system messages. It has no special properties. | |||
|- | |||
| {{ns:10}} | |||
| Used to hold [[#Templates|templates]]. To facilitate this it has the special property that it is the ''default'' namespace for transclusions. | |||
|- | |||
| {{ns:11}} | |||
| A talk namespace that is normally used for discussion of the template pages. It has no special properties. | |||
|- | |||
| {{ns:12}} | |||
| Used to hold help files, instructions and 'how-to' guides. It has no special properties. | |||
|- | |||
| {{ns:13}} | |||
| Used for discussions related to the help pages. It has no special properties. | |||
|- | |||
| {{ns:14}} | |||
| Contains [[#Categories|categories]] (dynamic lists of other pages). To facilitate this, linking ''directly'' to a category page does not output an inline link, but instead adds the page into the associated category page. | |||
|- | |||
| {{ns:15}} | |||
| Used for discussion of the category pages. It has no special properties. | |||
|} | |||
=== Talk pages === | |||
The MediaWiki namespaces are organised in pairs, with each pair containing a 'subject namespace' and a 'discussion namespace'. Every page in a subject namespace has an associated talk page which can be used to communicate with other users. Talk pages can be accessed by clicking the “{{lcfirst:{{int:talk}}}}” tab at the top of a page. Simply edit the page as normal to add your comment. Also see [[wikipedia:Help:Using talk pages]]. | |||
=== User pages === | |||
A '''user page''' in the {{ns:user}} namespace is a page about a member of the wiki. If you have registered, you can create your own user page. Your user page is linked in the top right. Others will see links to your user page from various places which assist wiki collaboration, including the “{{int:Recentchanges}}” and “{{lcfirst:{{int:history}}}}” pages. Every user page also has an associated "{{lcfirst:{{ns:3}}}} page". This is a special kind of talk page, for leaving messages directed at a particular user. Also see [[wikipedia:Wikipedia:User pages|Wikipedia:User pages]]. | |||
=== See also === | |||
* To list all the pages in a namespace see [[Special:Allpages]]. | |||
* [[wikipedia:Help:Namespaces]]. | |||
* [[mw:Manual:Namespace]]. | |||
* [[mw:Manual:Using custom namespaces]]. | |||
== Categories == | |||
Categories provide a way to automatically index and navigate between related pages. | |||
=== Adding a page to a category === | |||
To add a page to a category, include the following text (where '''''Name''''' is the name of the category). The usual place to add it is at the bottom of the page. You can use several of these tags to add a page to multiple categories. | |||
<nowiki>[[</nowiki>{{ns:category}}:'''''Name''''']] | |||
For a complete list of all existing categories see [[Special:Categories]]. | |||
=== Creating a category page === | |||
Pages in the '''{{ns:category}}:''' [[#Namespaces|namespace]] contain: | |||
* a normal body of text that can be edited, like any other page; and | |||
* an automatically-generated list of the pages in that category. | |||
If a category is used without creating a 'category page', it will be isolated from others and serve little purpose for organization or navigation. A category page can be created the same way as other wiki pages (see [[#Starting a new page|starting a new page]]); just add "<code>{{ns:category}}:</code>" before the page title. | |||
=== Managing the category hierarchy === | |||
Categories may belong to other categories in a hierarchy. Since category pages are much like any other page, a {{ns:category}} tag may be added to the bottom of a category page. It is a good practice to organize all categories into a hierarchy with a single top level category (we use [[:{{ns:Category}}:Root]]). | |||
For a list of categories that have been used without a category page, see [[Special:WantedCategories]]. | |||
=== Linking to a category === | |||
To create a normal wiki link to a category page (without adding your page to the category), prefix the link name with a colon. For example: | |||
:<code><nowiki>[[</nowiki>:{{ns:category}}:Help|Help category]]</code> → '''[[:{{ns:category}}:Help|Help category]]''' | |||
[[#Redirects|Redirect pages]] that redirect to categories must also use the colon, otherwise they will be added to the category instead of redirecting. | |||
=== See also === | |||
* [[wikipedia:Help:Categories]]. | |||
== Subpages == | |||
'''Subpages''' introduce hierarchical organization into wiki pages, with levels of the hierarchy separated by slashes (<code>/</code>). | |||
=== Where it works === | |||
By default, MediaWiki's subpage feature is turned off in the main namespace, but can be used on [[#Talk pages|talk pages]] and [[#User pages|user pages]]. In namespaces where the feature is switched off, any slashes (/) within a page name are simply part of the page name and do nothing special. | |||
=== How it works === | |||
Slashes (/) within a page name break the page into parent and subpages, recursively, e.g.: | |||
* [[{{NAMESPACE}}:{{PAGENAME}}]] - this page | |||
* [[{{NAMESPACE}}:{{PAGENAME}}/subpage]] - child page | |||
* [[{{NAMESPACE}}:{{PAGENAME}}/subpage/sub-subpage]] - grandchild page | |||
Note that the part of page names after a slash is case sensitive. In subpages, a link back to the parent page will automatically appear at the top. | |||
=== Use of subpages === | |||
Some typical uses for subpages are: | |||
* to create archives of old discussions under a [[#Talk pages|talk page]] | |||
* to create scratchpad editing spaces under a [[#User pages|user page]] | |||
Subpages are useful for organising information hierarchically. On the other hand, subpages tend to have a long name that is hard to remember, so it may be more user-friendly to use them as little as possible. You can also organize pages with the [[Help:Category|category]] feature, which is more suitable for creating a hierarchical network of information. | |||
=== See also === | |||
* [[wikipedia:Help:Subpages]]. | |||
* [[metawikipedia:Help:Link#Subpage feature]] | |||
* [[mw:Help:Variables#Page names]] | |||
* [[Special:PrefixIndex]] – Provides a list of subpages. | |||
== Templates == | |||
MediaWiki templates can be used to include standard messages on several wiki pages. If you change a template then the text will be updated on all of the pages where it is used. | |||
=== Template creation === | |||
Templates are standard wiki pages whose content is designed to be [[wikipedia:Transclusion|transcluded]]. You can [[#Starting a new page|create them like any other wiki page]]. Templates follow a convention that the name is prefixed with "<code>Template:</code>". | |||
=== Using templates === | |||
The tag <code><nowiki>{{Name}}</nowiki></code> transcludes the content of a template (stored in the page <nowiki>[[Template:Name]]</nowiki>). For example, if you have a page called "Template:Welcome" with the contents: | |||
Hello! Welcome to the wiki. | |||
You can insert the code <nowiki>{{Welcome}}</nowiki> in any other page, and when that page is viewed the text "Hello! Welcome to the wiki." will appear. | |||
An ordinary wiki page can also be used as a template, simply by specifying the full name with the namespace: | |||
*<code><nowiki>{{:Pagename}}</nowiki></code> includes <code><nowiki>[[Pagename]]</nowiki></code> | |||
*<code><nowiki>{{Foo:Pagename}}</nowiki></code> includes <code><nowiki>[[Foo:Pagename]]</nowiki></code> | |||
=== Controlling the time of transclusion === | |||
{| class="wikitable" | |||
! You write | |||
! Effect | |||
|- | |||
| <code><nowiki>{{Name}}</nowiki></code> | |||
| Transcludes the content of the template (stored in the page <nowiki>[[Template:Name]]</nowiki>) every time the page is fetched and displayed. If the template is later changed, the transcluding pages will automatically change too. | |||
|- | |||
| <code><nowiki>{{msgnw:Name}}</nowiki></code> | |||
| Includes the template in a form that displays it as raw wiki syntax (the way <code><nowiki><nowiki></nowiki></code> does). | |||
|- | |||
| <code><nowiki>{{subst:Name}}</nowiki></code> | |||
| This tag is substituted with the contents of the named template at the time you save the page. The contents can then be edited separately from the original in the template page. Note: don not use this if you want to continually propagate changes from the source template to the pages that reference it. | |||
|- | |||
| <code><nowiki>{{safesubst:Name}}</nowiki></code> | |||
| A type of substitution that doesn't break transclusion, see [[wikipedia:Help:Substitution#The safesubst: modifier]]. | |||
|} | |||
=== Parameters === | |||
MediaWiki allows parameters to be passed to a template when it is transcluded. There are three ways to pass parameters: anonymously, by number, and by name. | |||
To pass in '''anonymous parameters''' to a template, list the values of those parameters sequentially: | |||
<nowiki>{{Thankyou|all your effort|Joe}}</nowiki> | |||
Inside the template these parameters can be accessed by number: | |||
:<code><nowiki>{{{1}}}</nowiki></code> → ''all your effort'' | |||
:<code><nowiki>{{{2}}}</nowiki></code> → ''Joe'' | |||
To pass in parameters ''by number'', identify each parameter when passing it: | |||
<nowiki>{{Thankyou|2=Joe|1=all your effort}}</nowiki> | |||
The third way of passing parameters is '''by name''', instead of numbers. | |||
<nowiki>{{Thankyou|signature=Joe|reason=all your effort}}</nowiki> | |||
Inside the template these parameters can be accessed by name: | |||
:<code><nowiki>{{{signature}}}</nowiki></code> → ''Joe'' | |||
:<code><nowiki>{{{reason}}}</nowiki></code> → ''all your effort'' | |||
The advantage of using named parameters in your template, besides also being flexible in the order parameters can be passed, is that it makes the template code much easier to understand if there are many parameters. | |||
==== Default values ==== | |||
It is possible to define default values for parameters in case no value is passed in. The syntax to retrieve a parameter using a default value is: | |||
<nowiki>{{{ParameterName|DefaultValue}}}</nowiki> | |||
The default parameter can be ommitted, in which case it defaults to an empty string: | |||
<nowiki>{{{ParameterName|}}}</nowiki> | |||
=== Control template inclusion === | |||
Anything between <code><nowiki><noinclude></nowiki></code> and <code><nowiki></noinclude></nowiki></code> will be displayed only when the template page is viewed directly. | |||
Possible applications are: | |||
* Categorising templates | |||
* Explanatory text about how to use the template. | |||
To give usage information, include an example like this one on the template page: | |||
<pre><nowiki> | |||
<noinclude> | |||
== Usage == | |||
{{Thankyou|reason=your reason|signature=your signature}} | |||
</noinclude> | |||
</nowiki></pre> | |||
The converse is <code><nowiki><includeonly></nowiki></code>. Text between <code><nowiki><includeonly></nowiki></code> and <code><nowiki></includeonly></nowiki></code> will be processed and displayed only when the page is being included. The obvious application is to add all pages containing a given template to a [[#Categories|category]], without putting the template itself into that category. Notw: When you change the categories applied by a template, the categorization of the pages that use that template may not be updated until some time later. | |||
=== Organizing templates === | |||
For templates to be effective, users need to find them, and find out how to use them. For a list of all templates, see [[{{ns:special}}:Allpages/Template:]]. | |||
=== See also === | |||
* [[mw:Help:Template]] – contains a manual on how templates function | |||
* [[mw:Help:Embed page]] – embedding pages from [[#Namespaces|namespaces]] other than <code>Template:</code>. | |||
* [[wikipedia:Help:Templates]] | |||
== Redirects == | |||
Redirects are used to forward users from one page name to another. They can be useful if a particular article is referred to by multiple names, or has alternative punctuation, capitalization or spellings. | |||
=== Creating a redirect === | |||
You may start a new page with the name you want to direct from (see [[#Starting a new page|Starting a new page]]). You can also use an existing page that you are making inactive as a page by going to that page and using the "edit" tab at the top. In either case, insert the following code at the very start of the Edit window for the page: | |||
<nowiki>#REDIRECT [[</nowiki>''pagename''<nowiki>]]</nowiki> | |||
where ''pagename'' is the name of the destination page. There must be no space before the "#" symbol. Any text before the code will disable the code and prevent a redirect. | |||
=== Double redirects === | |||
A double redirect is a page redirecting to a page which is itself a redirect, and it will not work. Instead, people will be presented with a view of the next redirect page. This is a deliberate restriction, partly to prevent infinite loops, and partly to keep things simple. Double redirects should be eliminated by changing them to be 1-step redirects instead. Use the "what links here" toolbox link to find double redirects to a particular page, or use [[Special:DoubleRedirects]] to find them throughout the whole wiki. | |||
=== A redirect to a page in the category namespace === | |||
To prevent a page that redirects to a category from appearing in the category, precede the word "Category" with a colon: | |||
<nowiki>#REDIRECT [[:Category:Glossary]]</nowiki> | |||
=== See also === | |||
* [[wikipedia:Help:Redirects]] | |||
== Magic Words == | |||
'''Magic words''' are strings of text that MediaWiki interprets as a value or function. Page-dependent magic words will affect or return data about the ''current'' page (by default), even if the word is added through a transcluded template or included system message. | |||
=== Behavior switches === | |||
A behavior switch controls the layout or behaviour of the page and can often be used to specify desired omissions and inclusions. | |||
{| class="wikitable" | |||
|- | |||
! Word | |||
! Description | |||
|- | |||
| <code><nowiki>__NOTOC__</nowiki></code> | |||
| Hides the table of contents (TOC). | |||
|- | |||
| <code><nowiki>__FORCETOC__</nowiki></code> | |||
| Forces the table of contents to appear at its normal position (above the first header). | |||
|- | |||
| <code><nowiki>__TOC__</nowiki></code> | |||
| Places a table of contents at the word's current position (overriding <code><nowiki>__NOTOC__</nowiki></code>). If this is used multiple times, the table of contents will appear at the first word's position. | |||
|- | |||
| <code><nowiki>__NEWSECTIONLINK__</nowiki></code> | |||
| Adds a link ([[MediaWiki:Addsection|"+" by default]]) beside the "edit" tab for adding a new section on a non-talk page (see [[metawikipedia:Help:Section#Adding a section at the end|Adding a section to the end]]). | |||
|- | |||
| <code><nowiki>__NOINDEX__</nowiki></code> | |||
| Tell search engines not to index the page (ie, do not list in search engines' results). | |||
|} | |||
=== Variables === | |||
Variables return information about the current page, wiki, or date. Their syntax is similar to templates. | |||
==== Technical metadata ==== | |||
Revision variables return data about the latest edit to the current page, even if viewing an older version of the page. | |||
{| class="wikitable" | |||
|- | |||
! Variable | |||
! Output | |||
! Description | |||
|- | |||
! style="background:#e9e9e9; color:black;" colspan="3"| '''Site''' | |||
|- | |||
| <code><nowiki>{{SITENAME}}</nowiki></code> | |||
| {{SITENAME}} | |||
| The wiki's site name. | |||
|- | |||
| <code><nowiki>{{SERVER}}</nowiki></code> | |||
| {{SERVER}} | |||
| Domain URL. | |||
|- | |||
| <code><nowiki>{{SERVERNAME}}</nowiki></code> | |||
| {{SERVERNAME}} | |||
| Domain name. | |||
|- | |||
| <code><nowiki>{{SCRIPTPATH}}</nowiki></code> | |||
| {{SCRIPTPATH}} | |||
| Relative path to the wiki scripts on the server. | |||
|- | |||
| <code><nowiki>{{STYLEPATH}}</nowiki></code> | |||
| {{STYLEPATH}} | |||
| Relative path to the wiki style sheet on the server. | |||
|- | |||
| <code><nowiki>{{CURRENTVERSION}}</nowiki></code> | |||
| {{CURRENTVERSION}} | |||
| The wiki's MediaWiki version. | |||
|- | |||
! style="background:#e9e9e9; color:black;" colspan="3"| '''Latest revision to current page''' | |||
|- | |||
| <code><nowiki>{{REVISIONID}}</nowiki></code> | |||
| {{REVISIONID}} | |||
| Unique revision ID | |||
|- | |||
| <code><nowiki>{{REVISIONDAY}}</nowiki></code> | |||
| {{REVISIONDAY}} | |||
| Day the edit was made (unpadded number) | |||
|- | |||
| <code><nowiki>{{REVISIONMONTH}}</nowiki></code> | |||
| {{REVISIONMONTH}} | |||
| Month the edit was made | |||
|- | |||
| <code><nowiki>{{REVISIONYEAR}}</nowiki></code> | |||
| {{REVISIONYEAR}} | |||
| Year the edit was made | |||
|- | |||
| <code><nowiki>{{REVISIONTIMESTAMP}}</nowiki></code> | |||
| {{REVISIONTIMESTAMP}} | |||
| Timestamp of the edit | |||
|- | |||
| <code><nowiki>{{REVISIONUSER}}</nowiki></code> | |||
| {{REVISIONUSER}} | |||
| The user who made the most recent edit to the page, or the current user when previewing an edit | |||
|- | |||
| <code><nowiki>{{PROTECTIONLEVEL:</nowiki>''action''<nowiki>}}</nowiki></code> | |||
| protection level | |||
| The protection level (e.g. 'autoconfirm', 'sysop') for a given action (e.g. 'edit', 'move') on the current page or an empty string if not protected. | |||
|- | |||
! style="background:#e9e9e9; color:black;" colspan="3"| '''Affects page content''' | |||
|- | |||
| <code><nowiki>{{DISPLAYTITLE:</nowiki>''title''<nowiki>}}</nowiki></code> | |||
| | |||
| Format the current page's title. The value must be equivalent to the default title: only capitalization changes and replacing spaces with underscores are allowed. | |||
|- | |||
| <code><nowiki>{{DEFAULTSORT:</nowiki>''sortkey''<nowiki>}}</nowiki></code><br /><code><nowiki>{{DEFAULTSORTKEY:</nowiki>''sortkey''<nowiki>}}</nowiki></code><br /><code><nowiki>{{DEFAULTCATEGORYSORT:</nowiki>''sortkey''<nowiki>}}</nowiki></code> | |||
| | |||
| Used for categorizing pages, sets a default [[#Categories|category sort key]]. For example if you put <code><nowiki>{{DEFAULTSORT:Smith, John}}</nowiki></code> at the end of [[John Smith]], the page would be sorted under "S" by default in categories. | |||
|} | |||
==== Statistics ==== | |||
Numbers returned by these variables normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example, <code><nowiki>{{NUMBEROFPAGES}}</nowiki></code> → {{NUMBEROFPAGES}} and <code><nowiki>{{NUMBEROFPAGES:R}}</nowiki></code> → {{NUMBEROFPAGES:R}}). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example <code><nowiki>{{PAGESINCATEGORY:Help}}</nowiki></code> and <code><nowiki>{{PAGESINCATEGORY:Help|R}}</nowiki></code>). Also applicable to <code><nowiki>{{PAGESIZE:</nowiki>''page name''<nowiki>}}</nowiki></code> above. | |||
{| class="wikitable" | |||
|- | |||
! Variable | |||
! Output | |||
! Description | |||
|- | |||
! style="background:#e9e9e9; color:black;" colspan="3"| '''Entire wiki''' | |||
|- | |||
| <code><nowiki>{{NUMBEROFPAGES}}</nowiki></code> | |||
| {{NUMBEROFPAGES}} | |||
| Number of wiki pages. | |||
|- | |||
| <code><nowiki>{{NUMBEROFARTICLES}}</nowiki></code> | |||
| {{NUMBEROFARTICLES}} | |||
| Number of pages in [[mw:Manual:Using custom namespaces#Content namespaces|content namespaces]]. | |||
|- | |||
| <code><nowiki>{{NUMBEROFFILES}}</nowiki></code> | |||
| {{NUMBEROFFILES}} | |||
| Number of uploaded files. | |||
|- | |||
| <code><nowiki>{{NUMBEROFEDITS}}</nowiki></code> | |||
| {{NUMBEROFEDITS}} | |||
| Number of page edits. | |||
|- | |||
| <code><nowiki>{{NUMBEROFVIEWS}}</nowiki></code> | |||
| {{NUMBEROFVIEWS}} | |||
| Number of page views. Usually useless on a wiki using caching. | |||
|- | |||
| <code><nowiki>{{NUMBEROFUSERS}}</nowiki></code> | |||
| {{NUMBEROFUSERS}} | |||
| Number of registered users. | |||
|- | |||
| <code><nowiki>{{NUMBEROFADMINS}}</nowiki></code> | |||
| {{NUMBEROFADMINS}} | |||
| Number of users in the ''sysop'' admin group. | |||
|- | |||
| <code><nowiki>{{NUMBEROFACTIVEUSERS}}</nowiki></code> | |||
| {{NUMBEROFACTIVEUSERS}} | |||
| Number of active users, based on the criteria used in [[{{#special:Statistics}}]]. | |||
|- | |||
| <code><nowiki>{{NUMBERINGROUP:</nowiki>''groupname''<nowiki>}}</nowiki></code><br /><code><nowiki>{{NUMINGROUP:</nowiki>''groupname''<nowiki>}}</nowiki></code> | |||
| | |||
| Number of users in a specific [[mw:Manual:User rights|group]]. | |||
|} | |||
==== Page name variables ==== | |||
{| class="wikitable" | |||
|- | |||
! Variable | |||
! Output | |||
! Description | |||
|- | |||
| <code><nowiki>{{FULLPAGENAME}}</nowiki></code> | |||
| {{FULLPAGENAME}} | |||
| Namespace and page title. | |||
|- | |||
| <code><nowiki>{{PAGENAME}}</nowiki></code> | |||
| {{PAGENAME}} | |||
| Page title. | |||
|- | |||
| <code><nowiki>{{BASEPAGENAME}}</nowiki></code> | |||
| {{BASEPAGENAME}} | |||
| Page title excluding the current [[#Subpages|subpage]] and namespace. For more complex splitting, use <code><nowiki>{{</nowiki>[[mw:Help:Extension:ParserFunctions#.23titleparts|#titleparts:]]<nowiki>}}</nowiki></code>. | |||
|- | |||
| <code><nowiki>{{SUBPAGENAME}}</nowiki></code> | |||
| {{SUBPAGENAME}} | |||
| The [[#Subpages|subpage]] title. | |||
|- | |||
| <code><nowiki>{{SUBJECTPAGENAME}}</nowiki></code> | |||
| {{SUBJECTPAGENAME}} | |||
| The namespace and title of the associated content page. | |||
|- | |||
| <code><nowiki>{{TALKPAGENAME}}</nowiki></code> | |||
| {{TALKPAGENAME}} | |||
| The namespace and title of the associated talk page. | |||
|} | |||
The following are equivalents encoded for use in MediaWiki URLs (i.e. spaces replaced with underscores and some characters percent-encoded): | |||
* <code><nowiki>{{FULLPAGENAMEE}}</nowiki></code> | |||
* <code><nowiki>{{PAGENAMEE}}</nowiki></code> | |||
* <code><nowiki>{{BASEPAGENAMEE}}</nowiki></code> | |||
* <code><nowiki>{{SUBPAGENAMEE}}</nowiki></code> | |||
* <code><nowiki>{{SUBJECTPAGENAMEE}}</nowiki></code> | |||
* <code><nowiki>{{TALKPAGENAMEE}}</nowiki></code> | |||
These can all take a parameter allowing specification of the page to be operated on, instead of just the current page: | |||
* <code><nowiki>{{PAGENAME:Template:Main Page}}</nowiki></code> → '''{{PAGENAME:Template:Main Page}}''' | |||
==== Namespace variables ==== | |||
{| class="wikitable" | |||
|- | |||
! Variable | |||
! Output | |||
! Description | |||
|- | |||
| <code><nowiki>{{NAMESPACE}}</nowiki></code> | |||
| {{NAMESPACE}} | |||
| Name of the page's namespace | |||
|- | |||
| <code><nowiki>{{SUBJECTSPACE}}</nowiki></code><br /><code><nowiki>{{ARTICLESPACE}}</nowiki></code> | |||
| {{SUBJECTSPACE}}<br />{{ARTICLESPACE}} | |||
| Name of the associated content namespace | |||
|- | |||
| <code><nowiki>{{TALKSPACE}}</nowiki></code> | |||
| {{TALKSPACE}} | |||
| Name of the associated talk namespace | |||
|} | |||
The following are equivalents encoded for use in MediaWiki URLs (spaces replaced with underscores and some characters percent-encoded): | |||
* <code><nowiki>{{NAMESPACEE}}</nowiki></code> | |||
* <code><nowiki>{{SUBJECTSPACEE}}</nowiki></code> | |||
* <code><nowiki>{{TALKSPACEE}}</nowiki></code> | |||
These can take a page name instead of operating on the current page: | |||
* <code><nowiki>{{NAMESPACE:Template:Main Page}}</nowiki></code> → '''{{NAMESPACE:Template:Main Page}}''' | |||
* <code><nowiki>{{SUBJECTSPACE:Template:Main Page}}</nowiki></code> → '''{{SUBJECTSPACE:Template:Main Page}}''' | |||
* <code><nowiki>{{TALKSPACE:Template:Main Page}}</nowiki></code> → '''{{TALKSPACE:Template:Main Page}}''' | |||
=== Parser functions === | |||
Parser functions have the same syntax as templates. The names are sometimes prefixed with a hash to distinguish them from template page names. | |||
==== Conditional expressions ==== | |||
===== #if ===== | |||
This function tests whether the first parameter is non-empty. It evaluates to false if the test string is empty or contains only whitespace characters (spaces, newlines, etc). | |||
<tt><nowiki>{{#if:</nowiki> ''test string'' | ''value if true'' | ''value if false'' <nowiki>}}</nowiki></tt> | |||
===== #ifeq ===== | |||
This parser function compares two strings and determines whether they are identical. | |||
<tt><nowiki>{{#ifeq:</nowiki> ''string 1'' <nowiki>|</nowiki> ''string 2'' <nowiki>|</nowiki> ''value if identical'' <nowiki>|</nowiki> ''value if different'' <nowiki>}}</nowiki></tt> | |||
===== #iferror ===== | |||
This function evaluates to <tt>true</tt> if the input string contains an HTML object with <tt>class="error"</tt>, as generated by other parser functions such as <tt>[[##expr|#expr]]</tt>, <tt>[[##time|#time]]</tt> and <tt>[[##rel2abs|#rel2abs]]</tt>, [[mw:Help:Template|template]] and errors such as loops and recursions. | |||
<tt><nowiki>{{#iferror:</nowiki> ''test string'' <nowiki>|</nowiki> ''value if error'' <nowiki>|</nowiki> ''value if correct'' <nowiki>}}</nowiki></tt> | |||
===== #ifexpr ===== | |||
This function evaluates a mathematical expression and returns one of two strings depending on the boolean value of the result: | |||
<tt><nowiki>{{#ifexpr:</nowiki> ''expression'' <nowiki>|</nowiki> ''value if true'' <nowiki>|</nowiki> ''value if false'' <nowiki>}}</nowiki></tt> | |||
===== #ifexist ===== | |||
This function returns one of two values depending on whether a page exists on the local wiki. | |||
<tt><nowiki>{{#ifexist:</nowiki> ''page title'' | ''value if the page exists'' | ''value if it doesn't exist'' <nowiki>}}</nowiki></tt> | |||
===== #switch ===== | |||
This function compares one input value against several test cases, returning an associated string if a match is found. | |||
<nowiki>{{#switch:</nowiki> ''comparison string'' | |||
| ''case1'' = ''result1'' | |||
| ''case2'' = ''result2'' | |||
| ''...'' | |||
| ''caseN'' = ''resultN'' | |||
| ''default result0'' | |||
<nowiki>}}</nowiki> | |||
===== #expr ===== | |||
This function evaluates a mathematical expression and returns the calculated value. See [[metawikipedia:Help:Calculation]] for details of operators and constants. | |||
<tt><nowiki>{{#expr:</nowiki> ''expression'' <nowiki>}}</nowiki></tt> | |||
==== URL data ==== | |||
{| class="wikitable" | |||
|- | |||
! Parser function | |||
! Input → Output | |||
! Description | |||
|- | |||
| <code><nowiki>{{localurl:</nowiki>''page name''<nowiki>}}</nowiki></code><br /><code><nowiki>{{localurl:</nowiki>''page name''<nowiki>|</nowiki>''query_string''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{localurl:MediaWiki}}</nowiki></code> → {{localurl:MediaWiki}}<br /><code><nowiki>{{localurl:MediaWiki|printable=yes}}</nowiki></code> → {{localurl:MediaWiki|printable=yes}} | |||
| The relative path to the title. | |||
|- | |||
| <code><nowiki>{{fullurl:</nowiki>''page name''<nowiki>}}</nowiki></code><br /><code><nowiki>{{fullurl:</nowiki>''page name''<nowiki>|</nowiki>''query_string''<nowiki>}}</nowiki></code><br /><code><nowiki>{{fullurl:</nowiki>''interwiki:remote page name''<nowiki>|</nowiki>''query_string''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{fullurl:Category:Top level}}</nowiki></code> → {{fullurl:Category:Top level}}<br /> | |||
<code><nowiki>{{fullurl:Category:Top level|action=edit}}</nowiki></code> → {{fullurl:Category:Top level|action=edit}} | |||
| The absolute path to the title. This will also resolve [[#Interwiki links|Interwiki]] prefixes. | |||
|- | |||
| <code><nowiki>{{filepath:</nowiki>''file name''<nowiki>}}</nowiki></code><br /><code><nowiki>{{filepath:</nowiki>''file name''<nowiki>|nowiki}}</nowiki></code> | |||
| <code><nowiki>{{filepath:Example.jpg}}</nowiki></code> → {{filepath:Example.jpg}}<br /> | |||
| The absolute URL to the full size media file. | |||
|- | |||
| <code><nowiki>{{#rel2abs:</nowiki> ''path'' <nowiki>}}</nowiki></code><br /><code><nowiki>{{#rel2abs:</nowiki> ''path'' <nowiki>|</nowiki> ''base path'' <nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{#rel2abs:</nowiki>.<nowiki>}}</nowiki></code> → {{#rel2abs:.}}<br /><code><nowiki>{{#rel2abs:</nowiki>.<nowiki>|</nowiki>Help:Contents<nowiki>}}</nowiki></code> → {{#rel2abs:.|Help:Contents}} | |||
| Converts a relative file path into an absolute filepath. In <code>path</path> the following syntax is valid: | |||
*<code>.</code> → the current level | |||
*<code>..</code> → "go up one level" | |||
*<code>/foo</code> → "go into the subdirectory /foo" | |||
If <code>base path</code> is not specified, the full page name of the page will be used instead. | |||
|} | |||
==== Date and time functions ==== | |||
{| class="wikitable" | |||
|- | |||
! Variable | |||
! Output | |||
! Description | |||
|- | |||
| <code><nowiki>{{#timel: Y F d, h:i:s}}</nowiki></code> | |||
| {{#timel: Y F d, h:i:s}} | |||
| Displays the current time and date in the local timezone of the wiki. Due to caching, these variables frequently show when the page was cached rather than the current time. | |||
|} | |||
==== Namespace functions ==== | |||
<code><nowiki>{{ns:}}</nowiki></code> returns the localized name for a [[#Namespaces|namespace]]. <code><nowiki>{{nse:}}</nowiki></code> is the equivalent encoded for MediaWiki URLs. It does the same, but it replaces spaces with underscores, making it usable in external links. | |||
{| class="wikitable" | |||
|- | |||
! style="background:#e9e9e9; color:black;" colspan="2" width="50%" | Content namespaces | |||
! rowspan="12" | | |||
! style="background:#e9e9e9; color:black;" colspan="2" width=%50%" | Talk namespaces | |||
|- | |||
! Usage | |||
! Output | |||
! Usage | |||
! Output | |||
|- | |||
| <code><nowiki>{{ns:-2}}</nowiki></code> or <code><nowiki>{{ns:Media}}</nowiki></code> | |||
| {{ns:-2}} || || | |||
|- | |||
| <code><nowiki>{{ns:-1}}</nowiki></code> or <code><nowiki>{{ns:Special}}</nowiki></code> | |||
| {{ns:-1}} || || | |||
|- | |||
| <code><nowiki>{{ns:0}}</nowiki></code> or <code><nowiki>{{ns:}}</nowiki></code> | |||
| {{ns:}} | |||
| <code><nowiki>{{ns:1}}</nowiki></code> or <code><nowiki>{{ns:Talk}}</nowiki></code> | |||
| {{ns:1}} | |||
|- | |||
| <code><nowiki>{{ns:2}}</nowiki></code> or <code><nowiki>{{ns:User}}</nowiki></code> | |||
| {{ns:2}} | |||
| <code><nowiki>{{ns:3}}</nowiki></code> or <code><nowiki>{{ns:User talk}}</nowiki></code> | |||
| {{ns:3}} | |||
|- | |||
| <code><nowiki>{{ns:4}}</nowiki></code> or <code><nowiki>{{ns:Project}}</nowiki></code> | |||
| {{ns:4}} | |||
| <code><nowiki>{{ns:5}}</nowiki></code> or <code><nowiki>{{ns:Project talk}}</nowiki></code> | |||
| {{ns:5}} | |||
|- | |||
| <code><nowiki>{{ns:6}}</nowiki></code> or <code><nowiki>{{ns:File}}</nowiki></code> or <code><nowiki>{{ns:Image}}</nowiki></code> | |||
| {{ns:6}} | |||
| <code><nowiki>{{ns:7}}</nowiki></code> or <code><nowiki>{{ns:File talk}}</nowiki></code> or <code><nowiki>{{ns:Image talk}}</nowiki></code> | |||
| {{ns:7}} | |||
|- | |||
| <code><nowiki>{{ns:8}}</nowiki></code> or <code><nowiki>{{ns:MediaWiki}}</nowiki></code> | |||
| {{ns:8}} | |||
| <code><nowiki>{{ns:9}}</nowiki></code> or <code><nowiki>{{ns:MediaWiki talk}}</nowiki></code> | |||
| {{ns:9}} | |||
|- | |||
| <code><nowiki>{{ns:10}}</nowiki></code> or <code><nowiki>{{ns:Template}}</nowiki></code> | |||
| {{ns:10}} | |||
| <code><nowiki>{{ns:11}}</nowiki></code> or <code><nowiki>{{ns:Template talk}}</nowiki></code> | |||
| {{ns:11}} | |||
|- | |||
| <code><nowiki>{{ns:12}}</nowiki></code> or <code><nowiki>{{ns:Help}}</nowiki></code> | |||
| {{ns:12}} | |||
| <code><nowiki>{{ns:13}}</nowiki></code> or <code><nowiki>{{ns:Help talk}}</nowiki></code> | |||
| {{ns:13}} | |||
|- | |||
| <code><nowiki>{{ns:14}}</nowiki></code> or <code><nowiki>{{ns:Category}}</nowiki></code> | |||
| {{ns:14}} | |||
| <code><nowiki>{{ns:15}}</nowiki></code> or <code><nowiki>{{ns:Category talk}}</nowiki></code> | |||
| {{ns:15}} | |||
|} | |||
==== Formatting functions ==== | |||
{| class="wikitable" | |||
! Usage | |||
! Input → Output | |||
! Description | |||
|- | |||
|- | |||
| <code><nowiki>{{lc:</nowiki>''string''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{lc:DATA CENTER}}</nowiki></code> → {{lc:DATA CENTER}} | |||
| The lowercase input. | |||
|- | |||
| <code><nowiki>{{lcfirst:</nowiki>''string''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{lcfirst:DATA center}}</nowiki></code> → {{lcfirst:DATA center}} | |||
| The input with the first character lowercase. | |||
|- | |||
| <code><nowiki>{{uc:</nowiki>''string''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{uc:text transform}}</nowiki></code> → {{uc:text transform}} | |||
| The uppercase input. | |||
|- | |||
| <code><nowiki>{{ucfirst:</nowiki>''string''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{ucfirst:text TRANSFORM}}</nowiki></code> → {{ucfirst:text TRANSFORM}} | |||
| The input with the first character uppercase. | |||
|- | |||
| <code><nowiki>{{padleft:xyz|</nowiki>''stringlength''<nowiki>}}</nowiki></code><br /><code><nowiki>{{padleft:xyz|</nowiki>''strlen''<nowiki>|</nowiki>''char''<nowiki>}}</nowiki></code><br /><code><nowiki>{{padleft:xyz|</nowiki>''strlen''<nowiki>|</nowiki>''string''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{padleft:xyz|5}}</nowiki></code> → {{padleft:xyz|5}}<br /> <code><nowiki>{{padleft:xyz|5|_}}</nowiki></code> → {{padleft:xyz|5|_}} <code><nowiki>{{padleft:xyz|5|abc}}</nowiki></code> → {{padleft:xyz|5|abc}} <code><nowiki>{{padleft:xyz|2}}</nowiki></code> → {{padleft:xyz|2}}<br /> <code><nowiki>{{padleft:|1|xyz}}</nowiki></code> → {{padleft:|1|xyz}} (first character of the string)<br /> | |||
| Inserts a string of padding characters (parameter 3) of a specified length (parameter 2) next to a chosen base character or variable (first parameter). The final digits or characters in the base replace the final characters in the padding. The padding string may be truncated if its length does not evenly divide the required number of characters.<br /> | |||
|- | |||
| <code><nowiki>{{padright:xyz|</nowiki>''stringlength''<nowiki>}}</nowiki></code><br /><code><nowiki>{{padright:xyz|</nowiki>''strlen''<nowiki>|</nowiki>''char''<nowiki>}}</nowiki></code><br /><code><nowiki>{{padright:xyz|</nowiki>''strlen''<nowiki>|</nowiki>''string''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{padright:xyz|5}}</nowiki></code> → {{padright:xyz|5}}<br /> | |||
<code><nowiki>{{padright:xyz|5|_}}</nowiki></code> → {{padright:xyz|5|_}} | |||
<code><nowiki>{{padright:xyz|5|abc}}</nowiki></code> → {{padright:xyz|5|abc}} | |||
<code><nowiki>{{padright:xyz|2}}</nowiki></code> → {{padright:xyz|2}}<br /> | |||
<code><nowiki>{{padright:|1|xyz}}</nowiki></code> → {{padright:|1|xyz}}<br /> | |||
| Identical to padleft, but adds padding characters to the right side. | |||
|- | |||
| <code><nowiki>{{plural:2|</nowiki>''is''<nowiki>|</nowiki>''are''<nowiki>}}</nowiki></code> | |||
| <code><nowiki>{{plural:0|is|are}}</nowiki></code> → {{plural:0|is|are}}<br /> <code><nowiki>{{plural:1*1|is|are}}</nowiki></code> → {{plural:1*1|is|are}}<br /> <code><nowiki>{{plural:21 mod 10|is|are}}</nowiki></code> → {{plural:21 mod 10|is|are}}<br /> <code><nowiki>{{plural:{{#expr:21 mod 10}}|is|are}}</nowiki></code> → {{plural:{{#expr:21 mod 10}}|is|are}}<br /> <code><nowiki>{{plural:1|is|are}}</nowiki></code> → {{plural:1|is|are}}<br /> <code><nowiki>{{plural:2|is|are}}</nowiki></code> → {{plural:2|is|are}} | |||
| Outputs the singular form (second parameter) if the first parameter is an expression equalling one; the plural form (third parameter) otherwise. Plural transformations are used for languages like Russian based on "count mod 10". | |||
|- | |||
| <code><nowiki>{{#titleparts:</nowiki> ''pagename'' <nowiki>|</nowiki> ''number of segments to return'' <nowiki>|</nowiki> ''first segment to return'' <nowiki>}}</nowiki></code> | |||
| | |||
<code><nowiki>{{#titleparts:</nowiki> {{ns:1}}:Foo/bar/baz <nowiki>}}</nowiki></code> → '''{{#titleparts: {{ns:1}}:Foo/bar/baz }}'''<br /> | |||
<code><nowiki>{{#titleparts:</nowiki> {{ns:1}}:Foo/bar/baz <nowiki>| 1 }}</nowiki></code> → '''{{#titleparts: {{ns:1}}:Foo/bar/baz | 1 }}'''<br /> | |||
<code><nowiki>{{#titleparts:</nowiki> {{ns:1}}:Foo/bar/baz <nowiki>| 2 }}</nowiki></code> → '''{{#titleparts: {{ns:1}}:Foo/bar/baz | 2 }}'''<br /> | |||
<code><nowiki>{{#titleparts:</nowiki> {{ns:1}}:Foo/bar/baz <nowiki>| 2 | 2 }}</nowiki></code> → '''{{#titleparts: {{ns:1}}:Foo/bar/baz | 2 | 2 }}''' | |||
| Separates a pagetitle into segments based on slashes, then returns some of those segments as output. If the <code>number of segments</code> parameter is not specified, it defaults to "0", which returns ''all'' the segments. If the <code>first segment</code> parameter is not specified or is "0", it defaults to "1": | |||
|} | |||
==== Miscellaneous functions ==== | |||
{| class="wikitable plainlinks" | |||
! Usage | |||
! Output | |||
! Description | |||
|- | |||
| <code><nowiki>{{#special:</nowiki>''special page name''<nowiki>}}</nowiki><br /><nowiki>{{#special:userlogin}}</nowiki></code> | |||
| {{#special:special page name}}<br />{{#special:userlogin}} | |||
| The localized name for the given Special: page. | |||
|- | |||
| <code><nowiki>{{gender:</nowiki>''username''<br /><nowiki>|</nowiki>''return text if user is male''<br /><nowiki>|</nowiki>''return text if user is female''<br /><nowiki>|</nowiki>''return text if user hasn't defined their gender''<nowiki>}}</nowiki></code> | |||
| ''(depends on the named user's gender)'' | |||
| A switch for the gender set in [[{{#Special:Preferences}}]]<br/> | |||
Note: If 3rd parameter is omitted and user hasn't defined his/her gender, then <code>''text if user is male''</code> is returned. | |||
|} | |||
== Managing files and pages == | |||
=== Starting a new page === | |||
When a link points to an article that doesn't exist yet, the link will be coloured red. Clicking a red link will take you to the edit page where you can submit the new article. Usually this is the best way to create a new page, because it means that right from the start the page will be linked from at least one other place on the wiki. Normally there is no reason to create a page without first creating a red link to it. An alternative is to search for a page that doesn't exist (using the search box), which will provide a link to create a new stand-alone page. | |||
=== Copying a page === | |||
There is no facility to copy a page in MediaWiki, so you must copy and paste the wikitext. It is not possible to copy the edit history from one page to another. | |||
=== | === Moving (renaming) a page === | ||
{{ | The name of a page can be changed by using the "{{lc:{{MediaWiki:move}}}}" tab at the top. This tab is only visible if you are logged in. By using this feature, you also move the editing history of the page, which allows people to see how the contents of the page were built up, and who contributed what. Because the move operation leaves behind a redirect (see [[#Redirects|Redirects]]), it should not result in any broken links, however you might want to find pages which link to the old title, and change their text to link directly to the new title (see [[#Unlinking a page|Unlinking a page]]). | ||
This | |||
Deciding on a page title can be a difficult aspect of wiki organization, and one which can provoke debates. If the move could be considered controversial, you should propose the move first (see [[{{ns:Project}}:Propose a page move]]). | |||
[[ | As with all wiki editing, a move operation can be reversed. To reverse a move operation, simply move the page back to the previous name. If a page is renamed from "A" to "B" and then back to "A", a page with the title "B" will still be left behind, as a redirect from "B" to "A". To remove this page see [[#Deleting a page|deleting a page]]). Alternatively, users with the <code>suppressredirect</code> [[mw:Help:User rights|permission]] will see the option to move a page without creating a redirect. | ||
=== | === Deleting a page === | ||
Normal users cannot permanently delete a wiki page. This is a deliberate design feature; every kind of editing operation can be reverted and that includes resurrecting deleted pages. If for some reason you need a page to be deleted urgently, please see [[{{ns:Project}}:Mark a page for deletion]]. For any other deletion that might be controversial or disruptive, you should propose the change first (see [[{{ns:Project}}:Propose a page deletion]]). | |||
==== Unlinking a page ==== | |||
The "{{MediaWiki:whatlinkshere}}" feature in the {{MediaWiki:toolbox}} (at the bottom of the [[mw:Help:Navigation#Sidebar|sidebar]]) will tell you which other Wiki pages link to the current page. Always use this feature to check before deleting a page. These related pages will need to be edited for their links to reflect the change. | |||
== | == System Information == | ||
{{SITENAME}} is running MediaWiki <code>{{CURRENTVERSION}}</code>. See: | |||
* | * Detailed [[{{#Special:Version}}|version information and the list of extensions]] | ||
* The [[{{ns:Special}}:Interwiki|Interwiki Table]] | |||
* [[{{ns:Special}}:Statistics|Usage statistics]] | |||
* The [[{{ns:Special}}:NewFiles|gallery]] or [[{{ns:Special}}:ListFiles|list]] of recently uploaded files. | |||
* [[{{ns:Special}}:NewFiles|Unused files]] that might not be needed. | |||
* Other [[{{ns:Special}}:SpecialPages|SpecialPages]] | |||
==== | == See also == | ||
* A [[wikipedia:Help:Wiki markup|shorter wiki markup reference]] on Wikipedia. | |||
* | |||
Latest revision as of 11:14, 20 December 2018
This is a single-page reference guide for Nottinghack Wiki. If you are not familiar with wikitext and markup languages, see the tutorial on Using the Wiki.
About this Wiki
Nottinghack Wiki is powered by MediaWiki, the software used by Wikipedia. The main sources of documentation are:
This reference guide was based on the public domain Project:PD help.
Formatting
Basic Markup
Description | You type | You get |
---|---|---|
Italic text | two aprostrophes for ''italic'' text |
two aprostrophes for italic text |
Bold text | three aprostrophes for '''bold''' text |
three aprostrophes for bold text |
Bold and italic | five aprostrophes for '''''bold & italic''''' text |
five aprostrophes for bold & italic text |
Escape wiki markup | <nowiki>no '''''markup'''''</nowiki> |
no '''''markup''''' |
Some HTML tags are allowed by MediaWiki (full list).
Description | You type | You get |
---|---|---|
Underline | <u>Underline</u> |
Underline |
Strikethrough | <del>Strikethrough</del> or <s>Strikethrough</s> |
or
|
Monospaced text | <code>Source code</code> or <tt>Teletype text</tt> |
or Teletype text |
Superscript | C<sup>2</sup> |
C2 |
Subscript | C<sub>2</sub> |
C2 |
Size adjustments | <big>Larger text</big> <small>Smaller text</small> <small>Small text with <big>larger text</big> inside</small> <small><small>Really small text</small></small> |
Larger text Smaller text Small text with larger text inside Really small text |
Code | <code>code sample</code> |
|
Old-school font styling
Note: This is deprecated, so use CSS styling instead.
|
<font color="green" size="4" face="serif">Big Green Serifs</font> |
Big Green Serifs |
CSS styling | <span style="color:green; font-size:large; font-family:serif">Big Green Serifs</span> |
Big Green Serifs |
Abbreviation | <abbr title="World Taekwondo Federation">WTF</abbr> |
WTF |
Cite an author
Note: This is often used with a blockquote, shown in #Other section formatting.
|
<cite>John Doe</cite> |
John Doe |
Highlight text that has been inserted into a document. | This text <ins>has</ins> been corrected. |
This text has been corrected. |
Refer to a variable in a computer program | The variable <var>foo</var> has not been initialised. |
The variable foo has not been initialised. |
Formatting Pitfalls
Beware the unexpected results shown below.
Description | You type | You get |
---|---|---|
Overlapping HTML is invalid
Note: Results will vary between browsers.
|
Avoid <b>overlapping <i>html</b> tags</i>. |
[invalid HTML output] |
Multiline HTML formatting | Avoid <b>multiline html</b> formatting tags. |
[invalid HTML output] |
Wiki markup spanning paragraphs | Avoid '''''multiline wiki''''' markup. |
Avoid multiline wiki markup. |
Multiline wiki markup | Avoid '''''multiline wiki''''' markup. |
Avoid multiline wiki markup. |
Overlapping wiki markup
Note: This is valid, but can be confusing.
|
Basic '''overlapping ''wiki''' markup'' works OK. |
Basic overlapping wiki markup works OK. |
Symbols
An HTML symbol entity is a sequence of characters that produces one particular character. For example, €
produces the Euro symbol "€
" and ™
produces trademark symbol "™
". HTML symbol entities are allowed in MediaWiki and are sometimes used in advanced editing for two main reasons: to insert characters not normally available on keyboards and to prevent the parser from interpreting and displaying HTML tags and symbols:
- &euro; → €
- <span style="color:green;">Green</span> → <span style="color:green;">Green</span>
The following is a list of characters that can be produced using HTML symbols. Hover any character to find out the symbol that produces it. Some symbols not available in the current font will appear as empty squares.
HTML Symbol Entities | |||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Á | á | Â | â | ´ | Æ | æ | À | à | ℵ | Α | α | & | ∧ | ∠ | Å | å | ≈ | Ã | ã | Ä | ä | „ | Β | β | ¦ | • | ∩ | Ç | ç | ¸ | ¢ |
Χ | χ | ˆ | ♣ | ≅ | © | ↵ | ∪ | ¤ | † | ‡ | ↓ | ⇓ | ° | Δ | δ | ♦ | ÷ | É | é | Ê | ê | È | è | ∅ | Ε | ε | ≡ | Η | η | ||
Ð | ð | Ë | ë | € | ∃ | ƒ | ∀ | ½ | ¼ | ¾ | ⁄ | Γ | γ | ≥ | > | ↔ | ⇔ | ♥ | … | Í | í | Î | î | ¡ | Ì | ì | ℑ | ∞ | ∫ | Ι | ι |
¿ | ∈ | Ï | ï | Κ | κ | Λ | λ | ⟨ | « | ← | ⇐ | ⌈ | “ | ≤ | ⌊ | ∗ | ◊ | | ‹ | ‘ | < | ¯ | — | µ | · | − | Μ | μ | ∇ | – | |
≠ | ∋ | ¬ | ∉ | ⊄ | Ñ | ñ | Ν | ν | Ó | ó | Ô | ô | Œ | œ | Ò | ò | ‾ | Ω | ω | Ο | ο | ⊕ | ∨ | ª | º | Ø | ø | Õ | õ | ⊗ | Ö |
ö | ¶ | ∂ | ‰ | ⊥ | Φ | φ | Π | π | ϖ | ± | £ | ′ | ″ | ∏ | ∝ | Ψ | ψ | " | √ | ⟩ | » | → | ⇒ | ⌉ | ” | ℜ | ® | ⌋ | Ρ | ρ | |
› | ’ | ‚ | Š | š | ⋅ | § | | Σ | σ | ς | ∼ | ♠ | ⊂ | ⊆ | ∑ | ⊃ | ¹ | ² | ³ | ⊇ | ß | Τ | τ | ∴ | Θ | θ | ϑ | Þ | þ | ˜ | |
× | ™ | Ú | ú | ↑ | ⇑ | Û | û | Ù | ù | ¨ | ϒ | Υ | υ | Ü | ü | ℘ | Ξ | ξ | Ý | ý | ¥ | ÿ | Ÿ | Ζ | ζ | | |
Mathematical formulae
Formulae can be written in TeX using <math>
tags. See wikipedia:Help:Displaying a formula for details.
Description | You type | You get |
---|---|---|
The equation of mass-energy equivalence | <math>E = mc^2 \,\!</math> |
<math>E = mc^2 \,\!</math> |
The convolution theorem states that... | <math> \mathcal{F}\{f * g\} = k\cdot \mathcal{F}\{f\}\cdot \mathcal{F}\{g\}</math> |
<math> \mathcal{F}\{f * g\} = k\cdot \mathcal{F}\{f\}\cdot \mathcal{F}\{g\}</math> |
Signatures
In some situations you may want to sign your name or indicate when a change was made. You can do this easily using the tilde character (~
) as shown below. This is particularly useful on talk pages.
Function | You type | Automatically susbstituted wiki code | You get |
---|---|---|---|
Full signature (recommended) | ~~~~ |
|
Username 12:34, 1 February 2008 (UTC) |
Signature alone | ~~~ |
|
Username |
Timestamp alone | ~~~~~ |
12:34, 1 February 2008 (UTC)
|
12:34, 1 February 2008 (UTC) |
Layout
Section formatting can only be used at the beginning of a line. Note: Spaces at the start of a line are significant.
Headings
Headings of different levels are created by surrounding the line with equal signs (=).
== Level 2 == === Level 3 === ==== Level 4 ==== ===== Level 5 ===== ====== Level 6 ======
For each heading in the wiki article an HTML anchor is automatically created. That makes it possible to create links to section headings. An article with 4 or more headings automatically shows a table of contents.
Paragraphs
MediaWiki generally ignores single line breaks and joins consecutive lines of text together. To start a new paragraph, leave an empty line. To create a wide paragraph break, leave two empty lines. You can force a line break inside a paragraph with the HTML tag <br />
.
Description | You type | You get |
---|---|---|
Single line breaks are ignored | This text is joined together as if it were a single line. |
This text is joined together as if it were a single line. |
Empty lines define paragraphs
Note: Two empty lines give a larger paragraph break.
|
First paragraph. Second paragraph. The third paragraph will <br /> break in the middle. |
First paragraph. Second paragraph.
|
Other section formatting
Description | You type | You get |
---|---|---|
Bullet list |
* Start each line * with an [[Wikipedia:asterisk|asterisk]] (*). ** More asterisks gives deeper *** and deeper levels. * Line breaks<br />don't break levels. *** But jumping levels creates empty space. Any other new line ends the list. |
Any other new line ends the list. |
Numbered list |
# Start each line # with a [[Wikipedia:Number sign|number sign]] (#). ## More number signs gives deeper ### and deeper ### levels. # Line breaks<br />don't break levels. ### But jumping levels creates empty space. # Blank lines # end the list and start another. Any other new line also ends the list. |
Any other new line also ends the list. |
Definition list | ;item 1 : definition 1 ;item 2 : definition 2-1 : definition 2-2 |
|
Mixture of different types of list |
# one # two #* two point one #* two point two # three ## three sub 1 ### three sub 1 sub 1 ## three sub 2 |
|
Poetry | <poem> A programmer started to cuss, Because getting to sleep was a fuss. As he lay there in bed, Looping ’round in his head, Was: while(!asleep()) sheep++; -- <cite>Author unknown</cite> </poem> |
A programmer started to cuss, |
Blockquotes | text above text above <blockquote>blockquote</blockquote> text below text below |
text above text above
text below text below |
Preformatted text
Note: This way of preformatting only applies to section formatting. Text formatting markup is still effective.
|
Start each line with a space. * Text is '''preformatted''' and character formatting is effective. |
Start each line with a space. * Text is preformatted and character formatting is effective. |
Completely preformatted text | <pre> Text is '''preformatted''' and ''markup'' '''''is''''' not effective.</pre> |
Text is '''preformatted''' and ''markup'' '''''is''''' not effective. |
Syntax Highlighting for code | <syntaxhighlight lang="cpp">#include <iostream> using namespace std; int main (int argc, char** argv) { cout << "Hello World!"; return 0; }</syntaxhighlight> |
#include <iostream>
using namespace std;
int main (int argc, char** argv) {
cout << "Hello World!";
return 0;
}
|
A useful error message for syntax higlighting
Note: When an invalid 'lang' is used, the error message lists the available languages. Also see [1].
|
<syntaxhighlight lang="-"></syntaxhighlight> |
|
Horizontal rule | Text above ---- Text below |
Text above Text below |
Old-school centered text
Note: This is deprecated, so use the css method instead.
|
text above<center>centered</center>text below |
text above |
CSS method to center text | text above<div class="center" style="width:auto; margin-left:auto; margin-right:auto;">centered</div> text below |
text above centered
text below |
Comment | <!-- This is a comment --> Comments are only visible in the edit window. |
Comments are only visible in the edit window. |
Links
There are three sorts of links:
- Internal links to other pages in the wiki.
- External links to other websites.
- Interwiki links to other websites registered to the wiki in advance.
Internal links
To add an internal link, enclose the name of the page you want to link to in double square brackets. The first letter of the link is automatically capitalized and spaces are replaced with underscores.
Description | You type | You get |
---|---|---|
An internal link | [[NottingHack]] |
NottingHack |
A piped link | [[NottingHack|different text]] |
different text |
Word-endings are 'blended' | [[Help]]s [[Help]]ing [[Help]]ers [[Help]]anylettersyoulikehere [[Help]]<nowiki></nowiki>anylettersyoulikehere |
Helpanylettersyoulikehere |
Link to an anchor on the current page
Note: See links to section headings.
|
[[#See also]] |
#See also |
Link to an anchor from different text | [[#See also|different text]] |
different text |
Link to the current page's table of contents | [[#toc|Contents]] |
Contents |
Link to the top of the current page | [[#top|top]] |
top |
Setting an internal link anchor
Note: Omit the "optional text" for invisible anchor.
|
<div id="NameOfAnchorHere">optional text</div> |
optional text
|
Link to an anchor at another page | [[Help:Images#See also]] |
Help:Images#See also |
Shortcut to hide a namespace
See the pipe trick. |
[[Help:Contents|]] [[Help:Contents]] |
|
Redirect | #REDIRECT [[Main Page]] |
→ Main Page |
Link to the current page's talk page | [[{{TALKPAGENAME}}|Discussion]] |
Discussion |
Link to the current page's edit page | [{{fullurl:{{PAGENAME}}|action=edit}} Edit] |
Edit |
Link to a subpage | [[/example]] |
/example |
Link to a subpage without the leading slash | [[/example/]] |
example |
Link to a category page | [[:Category:Help]] |
Category:Help |
Link to an image or a file | [[media:example.jpg]] |
media:example.jpg |
Link to the user's user page | [[Special:MyPage]] |
Special:MyPage |
Additional wiki markup is permitted in link titles | [[#top|'''<del>rich</del>''' ''link text'' here.]] |
Links to section headings
You can link directly to headings within a wiki page. MediaWiki automatically creates an HTML anchor with the same name as the heading.
Description | You type | You get |
---|---|---|
Links to section headings | [[#External links|Links]] [[#Table pitfalls!]] |
External links
Description | You type | You get |
---|---|---|
External link | http://mediawiki.org |
http://mediawiki.org |
External link with different label | [http://mediawiki.org MediaWiki] |
MediaWiki |
Numbered external link | [http://mediawiki.org] |
[2] |
External links with file icons. | [http://en.wikipedia.org/wiki/.avi video]<br/> [http://en.wikipedia.org/wiki/.ogg sound]<br/> [http://en.wikipedia.org/wiki/.pdf document]<br/> |
|
External link to the same host | http://{{SERVERNAME}}/pagename |
http://wiki.nottinghack.org.uk/pagename |
External link to other host passing the pagename | http://google.com/search?q={{PAGENAMEE}} |
http://google.com/search?q=Marcus/MediaWiki_Quick_Reference |
Mailto link | [mailto:info@example.org email me] |
email me |
Mailto named with subject line and body | [mailto:info@example.org?Subject=URL%20Encoded%20Subject&body=Body%20Text info] |
info |
Additional wiki markup is permitted in link titles | [http://www.example.com/some/image.png Example '''<del>rich</del>''' ''link text'' here.] |
Example |
External link icons
Test link | Icon | Trigger |
---|---|---|
[3] | external-link-ltr-icon.png | .external , http:// , gopher://
|
[4] | lock-icon.png | https://
|
[5] | mail-icon.png | mailto:
|
[6] | news-icon.png | news://
|
[7] | file-icon.png | ftp://
|
[8] | talk-icon.png | irc://
|
[9] | audio-icon.png | .ogg , .mid , .midi , .mp3 , .wav , .wma
|
[10] | video-icon.png | .ogm , .avi , .mpeg , .mpg
|
[11] | document-icon.png | .pdf , .pdf# , .pdf?
|
How to avoid auto-links
By default, when you write a URL as is, it will be transformed to an external link. To avoid that effect, put the URL between <nowiki>
tags as in:
<nowiki>http://mediawiki.org</nowiki>
Interwiki links
Interwiki links are abbreviations for longer URLs. They can link to an external site almost as if they are linking to a page on Nottinghack Wiki. The external website must be registered in advance on the Special:Interwiki page.
Description | You type | You get |
---|---|---|
An interwiki link to a wikipedia article.
|
[[wikipedia:Sunflower|big yellow flower]] |
|
A similar external link (without using an interwiki link). | [http://en.wikipedia.org/wiki/Sunflower big yellow flower] |
The pipe trick
The pipe trick is a quick way to abbreviate certain types of links while you are editing wiki text. Once you save the page, the abbreviations are substituted with the full versions of the links. Some examples are shown below and more details can be found in wikipedia:Help:Pipe trick and metawikipedia:Help:Piped link#Pipe trick.
Description | You type | Substitution | You get |
---|---|---|---|
Page title with parentheses | [[top (Unix)|]] |
[[top (Unix)|top]] |
|
Page title with commas | [[top, unix|]] |
[[top, unix|top]] |
|
Page title with namespace | [[Help:Contents|]] |
[[Help:Contents|Contents]] |
|
An interwiki link | [[wikipedia:top (Unix)|]] |
[[wikipedia:top (Unix)|top]] |
Tables
Tables can be added to wiki pages using either XHTML table elements directly, or using wikitext formatting to define the table. The benefit of wikitext is that it tends to be easier to see the table structure when editing.
As a general rule, it is best to avoid using a table unless you need one. Table markup often complicates page editing.
Wiki table markup summary
{| |
table start |
|+ |
table caption, optional; only between table start and the first table row |
|- |
table row, optional on the first row |
! |
table header cell, optional. |
| |
table data cell, required! |
|} |
table end |
These markers can also be used to write several consecutive table cells on the same line:
!! |
Start a consecutive table header cell. |
|| |
Start a consecutive table data cell. |
Basic table examples
The following table lacks borders and good spacing but shows the simplest wiki markup table structure.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| |Orange |Apple |- |Bread |Pie |- |Butter |Ice cream |} |
|
The cells in the same row can be listed on one line separated by ||
(two pipe symbols). If the text in the cell contains a line break, use <br />
instead.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| |Orange||Apple||more |- |Bread||Pie||more |- |Butter||Ice<br />cream||and<br />more |} |
|
Extra spaces within cells in the wiki markup do not affect the actual table rendering:
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| | Orange || Apple || more |- | Bread || Pie || more |- | Butter || Ice cream || and more |} |
|
You can have longer text or more complex wiki syntax inside table cells:
You type | You get | ||
---|---|---|---|
{| |Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. | * Lorem ipsum dolor sit amet * consetetur sadipscing elitr * sed diam nonumy eirmod tempor invidunt |} |
|
Table headers
Table headers can be created by using "!
" (exclamation mark) instead of "|
" (pipe symbol). Headers usually show up bold and centered by default.
You type | You get | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| ! Item ! Amount ! Cost |- |Orange |10 |7.00 |- |Bread |4 |3.00 |- |Butter |1 |5.00 |- !Total | |15.00 |} |
|
A table caption can be added to any table as follows.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| |+Food complements |- |Orange |Apple |- |Bread |Pie |- |Butter |Ice cream |} |
|
Table attributes
The wikitext table markers can accept a space separated list of XHTML attributes. For example, this wikitext will start a row with green text:
|- style="color:green;"
In table cells and captions (|
or ||
, !
or !!
, and |+
) the attributes are separated from cell content with a single pipe character (|
).
|align="right"|This is a right-aligned table cell.
For the authoritative source on XHTML attributes, see the W3C's HTML 4.01 Specification page on tables.
Attributes on entire tables
Placing attributes after the table start tag ({|
) applies attributes to the entire table.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| border="1" align="center" style="text-align:center;" |Orange |Apple |12,333.00 |- |Bread |Pie |500.00 |- |Butter |Ice cream |1.00 |} |
|
Attributes on cells
You can put attributes on individual cells. For example, numbers may look better aligned right.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| border="1" |Orange |Apple |align="right" | 12,333.00 |- |Bread |Pie |align="right" | 500.00 |- |Butter |Ice cream |align="right" | 1.00 |} |
|
You can also use cell attributes when you are listing multiple cells on a single line. Note that the cells are separated by ||
, and within each cell the attributes and cell contents are separated by |
.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| border="1" | Orange || Apple || align="right" | 12,333.00 |- | Bread || Pie || align="right" | 500.00 |- | Butter || Ice cream || align="right" | 1.00 |} |
|
Attributes on rows
You can set attributes for individual rows.
You type | You get | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
{| border="1" |Orange |Apple |align="right"|12,333.00 |- |Bread |Pie |align="right"|500.00 |- style="font-style:italic; color:green;" |Butter |Ice cream |align="right"|1.00 |} |
|
One-pixel table borders
A one-pixel border can be achieved using separated borders or the collapsing border model.
You type | You get | ||||
---|---|---|---|---|---|
{|style="border-collapse: separate; border-spacing: 0; border-width: 1px; border-style: solid; border-color: #000; padding: 0" |- !style="border-style: solid; border-width: 0 1px 1px 0"| Orange !style="border-style: solid; border-width: 0 0 1px 0"| Apple |- |style="border-style: solid; border-width: 0 1px 0 0"| Bread |style="border-style: solid; border-width: 0"| Pie |} |
| ||||
{|style="border-collapse: collapse; border-width: 1px; border-style: solid; border-color: #000" |- !style="border-style: solid; border-width: 1px"| Orange !style="border-style: solid; border-width: 1px"| Apple |- |style="border-style: solid; border-width: 1px"| Bread |style="border-style: solid; border-width: 1px"| Pie |} |
|
HTML colspan and rowspan
You can use HTML colspan
and rowspan
attributes on cells for advanced layout.
You type | You get | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| border="1" !colspan="6"|Shopping List |- |rowspan="2"|Bread & Butter |Pie |Buns |Danish |colspan="2"|Croissant |- |Cheese |colspan="2"|Ice cream |Butter |Yoghurt |} |
|
Table attributes with CSS styles
CSS style attributes can be added to tables with or without other HTML attributes.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| style="color:green; background-color:#ffffcc;" cellpadding="10" cellspacing="0" border="1" |Orange |Apple |- |Bread |Pie |- |Butter |Ice cream |} |
|
Attributes can be added to the caption and headers as follows.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| border="1" cellpadding="20" cellspacing="0" |+ align="bottom" style="color:#e76700;" |''Food complements'' |- |Orange |Apple |- |Bread |Pie |- |Butter |Ice cream |} |
|
Accessibility of table header cells
Table header cells do not explicitly specify which table data cells they apply to (those on their right on the same row, or those below them on the same column). When the table is displayed in a visual 2D environment, this is usually obvious. However when tables are rendered on non-visual medias, you can help the browser to determine which table header cell applies to the description of any selected cell (in order to repeat its content in some accessibility helper) using a scope="row" or scope="col" attribute on table header cells. In most cases with simple tables, you'll use scope="col" on all header cells of the first row, and scope="row" on the first cell of the following rows:
You type | You get | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| border="1" cellspacing="0" cellpadding="2" |- !scope="col"| Item !scope="col"| Quantity !scope="col"| Price |- !scope="row"| Bread | 0.3 kg | $0.65 |- !scope="row"| Butter | 0.125 kg | $1.25 |- !scope="row" colspan="2"| Total | $1.90 |} |
|
Sortable tables
To make a table sortable add class="sortable"
as shown below.
You type | You get | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| class="wikitable sortable" |+Sortable table |- ! Letter !! Number !! Title |- | c || 1 || Five |- | b || 3 || rows |- | e || 5 || of |- | d || 2 || text |- | a || 0 || here. |} |
|
It is also possible to make some columns sortable and others non-sortable:
You type | You get | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{| class="wikitable sortable" |+Sortable table |- ! Letter !! class="unsortable"|Number !! Title |- | c || 1 || Five |- | b || 3 || rows |- | e || 5 || of |- | d || 2 || text |- | a || 0 || here. |} |
|
Table pitfalls!
If you start a cell on a new line with a negative number with a minus sign (or a parameter that evaluates to a negative number), your table can get broken, because the characters |-
will be parsed as the wiki markup for table row, not table cell. To avoid this, insert a space before the value (| -6
) or use in-line cell markup (|| -6
).
Images
Supported media types for images
The following file formats are supported on Nottinghack Wiki:
- .jpg or .jpeg : bitmap image compressed in the standard JPEG format (this lossy format is most suitable for photographs).
- .png : bitmap image in the Portable Network Graphics format (specified by the W3 Consortium).
- .gif : bitmap image in the legacy Graphics Interchange Format.
- .svg : scalable image in the Scalable Vector Graphics format (specified by the W3 Consortium).
Uploading an image
- In the sidebar, under “toolbox”, click “Upload file.”
- Select the “Source filename”
- You can fill in the optional “Summary” text. Note: This is a plain text summary, not wikitext.
After you upload a file, you will be redirected to the “file description page”. You should edit this page to provide more information about the file. For example, you should explain where you got the file from, and what its copyright status is.
Displaying an image
The wikitext to display an image is:
[[File:filename.extension|options|caption]]
The options can be given in any order separated by pipes (|):
border
- Adds a very thin border around the image.
frame
,frameless
,thumb
orthumbnail
- Controls how the image is formatted and embedded in the rest of the page. See the examples of image formats.
{width}x{height}px
- Resizes the image to fit inside a maximum {width} and {height} in pixels. See the examples of image resizing. Note: The image will always retain its aspect ratio.
{width}px
- Resizes the image using a maximum width in pixels.
x{height}px
- Resizes the image using maximum height in pixels.
upright
- Uses a resizing algorithm suitable for images in portrait orientation rather than landscape.
left
,right
,center
, ornone
- Controls the horizontal alignment (and inline/block or floating styles) of the image within a text (no default value).
baseline
,sub
,super
,top
,text-top
,middle
,bottom
, ortext-bottom
- Controls the vertical alignment of a non-floating inline image with the text before or after the image, and in the same block (the default vertical alignment is
middle
). link={target}
- Allows to change the target of the generated link associated with the image. See Altering the default link target. Note:
link
does not work withthumb
,thumbnail
orframe
. alt={alternative text}
- Defines the alternative text (maps to the HTML
alt="..."
attribute). page={number}
- Renders the specified page number (only applicable when showing a .djvu or .pdf file).
If a parameter does not match any of the other possibilities, it is assumed to be the caption text. Caption text is shown below the image in thumb and frame formats, or as mouseover text in border and frameless formats or when the format is omitted. Caption text displayed in the thumb and frame formats may contain wiki links and other formatting. In the other options, wiki-formatting will not work. If no caption text is supplied, a caption is automatically created showing the file name. To completely remove the caption, set it to <span title=""></span>
.
Image dimensions and borders
The effect of the size parameters depend on how the image is formatted, but images will always retain their aspect ratio. When the format is not specified the image can be reduced or enlarged to any size. An image with the frame
format always ignores the size specification and the original image will be reduced if it exceeds a maximum size. The size of an image with the thumb
format can be reduced, but can not be enlarged beyond the original image size unless it is a scalable media type.
In the examples below, the original size of the image is 400 × 267 pixels.
Format | You type | You get |
---|---|---|
(not specified) |
[[File:MediaWiki:Image sample|50px]] |
|
[[File:MediaWiki:Image sample|500px]] |
| |
border |
[[File:MediaWiki:Image sample|border|50px]] |
|
[[File:MediaWiki:Image sample|border|500px]] |
| |
frame |
[[File:MediaWiki:Image sample|frame|50px]] |
|
[[File:MediaWiki:Image sample|frame|500px]] Note: The size parameters have no effect when using the
frame format. |
| |
thumb |
[[File:MediaWiki:Image sample|thumb|50px]] |
|
[[File:MediaWiki:Image sample|thumb|500px]] Note: A
thumb image cannot be enlarged beyond the size of the original image. |
| |
frameless |
[[File:MediaWiki:Image sample|frameless|50px]] |
|
[[File:MediaWiki:Image sample|frameless|500px]] Note: A
frameless image cannot be enlarged beyond the size of the original image. |
Horizontal alignment
Note that when using the frame
or thumb[nail]
formats, the default horizontal alignment will be right
.
Description | You type | You get |
---|---|---|
no horizontal alignment specified, or default alignment Rendered as a floating block: no Rendered inline: yes |
text before [[File:example.jpg|100px|caption]] text after |
|
specify horizontal alignment as: none Rendered as a floating block: no Rendered inline: no |
text before [[File:example.jpg|none|100px|caption]] text after |
text before text after |
specify horizontal alignment as: center Rendered as a floating block: no Rendered inline: no |
text before [[File:example.jpg|center|100px|caption]] text after |
text before text after |
specify horizontal alignment as: left Rendered as a floating block: yes Rendered inline: no |
text before [[File:example.jpg|left|100px|caption]] text after |
text before text after |
specify horizontal alignment as: right Rendered as a floating block: yes Rendered inline: no |
text before [[File:example.jpg|right|100px|caption]] text after |
text before text after |
Vertical alignment
The vertical alignment options take effect only if the image is displayed as an inline element and is not floating. They alter the way the inlined image will be vertically aligned with the text present in the same block before and/or after this image on the same row. Note that the displayed line of text where inline images are inserted (and the lines of text displayed after the current one) may be moved down. The line spacing will increase, just as may occur with spans of text with variable font sizes to allow the image height to be fully displayed with this alignment constraint.
To show the alignment result more clearly in this example, the text spans are overlined and underlined, the line-height is increased and emphasized with a yellow background and grey border:
Source code for the example above<p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''top:''' [[File:Example.jpg|20px|top]] [[File:Example.jpg|40px|top]] [[File:Example.jpg|40px|border|top]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''text-top:''' [[File:Example.jpg|20px|text-top]] [[File:Example.jpg|40px|text-top]] [[File:Example.jpg|40px|border|text-top]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> <sup>super:</sup> [[File:Example.jpg|20px|super]] [[File:Example.jpg|40px|super]] [[File:Example.jpg|40px|border|super]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''baseline:''' [[File:Example.jpg|20px|baseline]] [[File:Example.jpg|40px|baseline]] [[File:Example.jpg|40px|border|baseline]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> <sub>'''sub:'''</sub> [[File:Example.jpg|20px|sub]] [[File:Example.jpg|40px|sub]] [[File:Example.jpg|40px|border|sub]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''default:''' [[File:Example.jpg|20px]][[File:Example.jpg|40px]] [[File:Example.jpg|40px|border]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''middle:''' [[File:Example.jpg|20px|middle]] [[File:Example.jpg|40px|middle]] [[File:Example.jpg|40px|border|middle]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''text-bottom:''' [[File:Example.jpg|20px|text-bottom]] [[File:Example.jpg|40px|text-bottom]] [[File:Example.jpg|40px|border|text-bottom]] <del>text</del></u></span></p> <p style="border:1px solid #AAA;background:#FFC;padding:0;font-size:150%;line-height:2"> <span style="background:#FFF;color:#000;text-decoration:overline"><u><del>text</del> '''bottom:'' [[File:Example.jpg|20px|bottom]] [[File:Example.jpg|40px|bottom]] [[File:Example.jpg|40px|border|bottom]] <del>text</del></u></span></p>
Stopping the text flow
On occasion it is desirable to stop text (or other inline non-floating images) from flowing around a floating image. Depending on the web browser's screen resolution and such, text flow on the right side of an image may cause a section header (for instance, == My Header ==) to appear to the right of the image, instead of below it, as a user may expect. The text flow can be stopped by placing <br style="clear: both" /> before the text that should start below the floating image.
All images displayed as blocks (including non-floating centered images, left- or right-floating images, as well as framed or thumbnailed floating images) are implicitly breaking the surrounding lines of text (terminating the current block of text before the image, and creating a new paragraph for the text after them). They will then stack vertically along their left or right alignment margin (or along the center line between these margins for centered images).
Altering the link target
The table below shows how to alter or remove the link target associated with an image. Note: The link attribute does not work with thumb
or frame
formats.
Description | You type | You get |
---|---|---|
internal link |
[[File:example.jpg|link=Main Page|caption]] |
|
external link |
[[File:example.jpg|link=http://wikipedia.org|caption]] |
|
no link (external or file page) |
[[File:example.jpg|link=|caption]] |
|
Displaying an image gallery
It's easy to make a gallery of thumbnails with the <gallery>
tag:
<gallery> Image:file_name.ext|caption Image:file_name.ext|caption {...} </gallery>
Note that the image code is not enclosed in quare brackets inside gallery tags. Captions are optional, and may contain wiki links or other formatting. For example:
<gallery> File:Example.jpg|Item 1 File:Example.jpg|a link to [[Help:Contents]] File:Example.jpg File:Example.jpg File:Example.jpg| ''italic caption'' File:Example.jpg|on page "{{PAGENAME}}" </gallery>
Is displayed as:
-
Item 1
-
a link to Help:Contents
-
italic caption
-
on page "Marcus/MediaWiki Quick Reference"
Optional gallery attributes
The gallery tag itself takes several additional parameters, specified as attribute name-value pairs:
<gallery {parameters}> {images} </gallery>
caption={caption}
: A caption for the gallery.widths={width}px
: The maximum width for the images. Note the plural (widths)heights={heights}px
: The maximum height for the images.perrow={integer}
: The number of images per row.showfilename={y or n}
: Show the filenames in the image captions.
Example wikitext:
<gallery widths=60px heights=60px perrow=7 caption="sunflowers are groovy"> File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg File:Example.jpg </gallery>
Result:
Linking to an image without displaying it
Link to the description page
If you put a colon (:
) before File:
, the image will not be embedded and the link will lead to the description page of the file.
Description | You type | You get |
---|---|---|
Link to the description page of the file | [[:{{ns:image}}:Example.jpg]] |
|
Link to the description page with a custom title. | [[:{{ns:image}}:Example.jpg|Sunflowers]] |
Link directly to the media file
You can use the pseudo-namespace “Media” to link directly to a file without displaying it, bypassing the description page.
Description | You type | You get |
---|---|---|
Link directly to a file. | [[{{ns:media}}:Example.jpg]] |
|
Link directly to a file, with a custom title. | [[{{ns:media}}:Example.jpg|Sunflowers]] |
|
link to a potential file, even if it doesn't exist. | [[{{#special:Filepath}}/Example.jpg]] |
|
Generate an external URL to the file | {{FILEPATH:Example.jpg}} |
Displaying images from other websites
Currently it is not possible to embed images from other websites into Nottinghack Wiki. Links are displayed instead. External image embedding could be enabled using mw:Manual:$wgAllowExternalImages.
Description | You type | You get |
---|---|---|
Link or embed an image from another website | http://upload.wikimedia.org/wikipedia/en/b/bc/Wiki.png |
Widgets
MediaWiki widgets allow you to embed web widgets into a wiki page. Each widget has its own documentation, which can be found in the list of available widgets.
Namespaces
Pages in MediaWiki are partitioned into 'namespaces', which indicate the purpose of the pages at a high level. Namespaces are specified in page titles by prefixing the page name with "namespace:
". For example, the prefix "User:
" in this page's title ("User:Marcus/MediaWiki Quick Reference") indicates that this page is in the User namespace.
Standard namespaces
These are the namespaces that exist on Nottinghack Wiki. Pages in some namespaces have special properties.
Namespace | Purpose and special properties |
---|---|
Media | An alias used to link directly to media files. |
Special | Used to group special pages, reports and interfaces that are generated 'on demand' by MediaWiki and which are not directly editable. |
Main | This namespace typically contains the bulk of the content pages in a wiki. It has no special properties. |
Talk | Used for discussion attached to the main namespace. It has no special properties. |
User | Each user has a corresponding page in the User namespace, which is linked to from edit histories, watchlists, recent changes, etc; wherever an individual user is uniquely identified. This page, and subpages of it, can be used by users to record information about themselves or to test and draft new content. |
User talk | A discussion space associated with the User namespace, mainly used to leave messages for particular users or inform them of discussions that may be of interest to them. |
Nottinghack Wiki | Normally used for content pages that document the operation and development of the wiki. It has no special properties. |
Nottinghack Wiki talk | Normally used for discussions related to the associated content pages. It has no special properties. |
File | Used to store metadata for images, videos, sound files and other media accessed via the Media namespace. Each file has a corresponding page in the File namespace which is often used to hold licensing data. Linking directly to a page in this namespace instead includes the media file inline in the page. See #Images for details of the link syntax. There is an alias "Image" for the File namespace. |
File talk | Normally used for discussion of the media files. It has no special properties. |
MediaWiki | Used to hold system messages and other important content. |
MediaWiki talk | A talk namespace that is normally used for discussions related to the system messages. It has no special properties. |
Template | Used to hold templates. To facilitate this it has the special property that it is the default namespace for transclusions. |
Template talk | A talk namespace that is normally used for discussion of the template pages. It has no special properties. |
Help | Used to hold help files, instructions and 'how-to' guides. It has no special properties. |
Help talk | Used for discussions related to the help pages. It has no special properties. |
Category | Contains categories (dynamic lists of other pages). To facilitate this, linking directly to a category page does not output an inline link, but instead adds the page into the associated category page. |
Category talk | Used for discussion of the category pages. It has no special properties. |
Talk pages
The MediaWiki namespaces are organised in pairs, with each pair containing a 'subject namespace' and a 'discussion namespace'. Every page in a subject namespace has an associated talk page which can be used to communicate with other users. Talk pages can be accessed by clicking the “discussion” tab at the top of a page. Simply edit the page as normal to add your comment. Also see wikipedia:Help:Using talk pages.
User pages
A user page in the User namespace is a page about a member of the wiki. If you have registered, you can create your own user page. Your user page is linked in the top right. Others will see links to your user page from various places which assist wiki collaboration, including the “Recent changes” and “page history” pages. Every user page also has an associated "user talk page". This is a special kind of talk page, for leaving messages directed at a particular user. Also see Wikipedia:User pages.
See also
- To list all the pages in a namespace see Special:Allpages.
- wikipedia:Help:Namespaces.
- mw:Manual:Namespace.
- mw:Manual:Using custom namespaces.
Categories
Categories provide a way to automatically index and navigate between related pages.
Adding a page to a category
To add a page to a category, include the following text (where Name is the name of the category). The usual place to add it is at the bottom of the page. You can use several of these tags to add a page to multiple categories.
[[Category:Name]]
For a complete list of all existing categories see Special:Categories.
Creating a category page
Pages in the Category: namespace contain:
- a normal body of text that can be edited, like any other page; and
- an automatically-generated list of the pages in that category.
If a category is used without creating a 'category page', it will be isolated from others and serve little purpose for organization or navigation. A category page can be created the same way as other wiki pages (see starting a new page); just add "Category:
" before the page title.
Managing the category hierarchy
Categories may belong to other categories in a hierarchy. Since category pages are much like any other page, a Category tag may be added to the bottom of a category page. It is a good practice to organize all categories into a hierarchy with a single top level category (we use Category:Root).
For a list of categories that have been used without a category page, see Special:WantedCategories.
Linking to a category
To create a normal wiki link to a category page (without adding your page to the category), prefix the link name with a colon. For example:
[[:Category:Help|Help category]]
→ Help category
Redirect pages that redirect to categories must also use the colon, otherwise they will be added to the category instead of redirecting.
See also
Subpages
Subpages introduce hierarchical organization into wiki pages, with levels of the hierarchy separated by slashes (/
).
Where it works
By default, MediaWiki's subpage feature is turned off in the main namespace, but can be used on talk pages and user pages. In namespaces where the feature is switched off, any slashes (/) within a page name are simply part of the page name and do nothing special.
How it works
Slashes (/) within a page name break the page into parent and subpages, recursively, e.g.:
- User:Marcus/MediaWiki Quick Reference - this page
- User:Marcus/MediaWiki Quick Reference/subpage - child page
- User:Marcus/MediaWiki Quick Reference/subpage/sub-subpage - grandchild page
Note that the part of page names after a slash is case sensitive. In subpages, a link back to the parent page will automatically appear at the top.
Use of subpages
Some typical uses for subpages are:
- to create archives of old discussions under a talk page
- to create scratchpad editing spaces under a user page
Subpages are useful for organising information hierarchically. On the other hand, subpages tend to have a long name that is hard to remember, so it may be more user-friendly to use them as little as possible. You can also organize pages with the category feature, which is more suitable for creating a hierarchical network of information.
See also
- wikipedia:Help:Subpages.
- metawikipedia:Help:Link#Subpage feature
- mw:Help:Variables#Page names
- Special:PrefixIndex – Provides a list of subpages.
Templates
MediaWiki templates can be used to include standard messages on several wiki pages. If you change a template then the text will be updated on all of the pages where it is used.
Template creation
Templates are standard wiki pages whose content is designed to be transcluded. You can create them like any other wiki page. Templates follow a convention that the name is prefixed with "Template:
".
Using templates
The tag {{Name}}
transcludes the content of a template (stored in the page [[Template:Name]]). For example, if you have a page called "Template:Welcome" with the contents:
Hello! Welcome to the wiki.
You can insert the code {{Welcome}} in any other page, and when that page is viewed the text "Hello! Welcome to the wiki." will appear.
An ordinary wiki page can also be used as a template, simply by specifying the full name with the namespace:
{{:Pagename}}
includes[[Pagename]]
{{Foo:Pagename}}
includes[[Foo:Pagename]]
Controlling the time of transclusion
You write | Effect |
---|---|
{{Name}}
|
Transcludes the content of the template (stored in the page [[Template:Name]]) every time the page is fetched and displayed. If the template is later changed, the transcluding pages will automatically change too. |
{{msgnw:Name}}
|
Includes the template in a form that displays it as raw wiki syntax (the way <nowiki> does).
|
{{subst:Name}}
|
This tag is substituted with the contents of the named template at the time you save the page. The contents can then be edited separately from the original in the template page. Note: don not use this if you want to continually propagate changes from the source template to the pages that reference it. |
{{safesubst:Name}}
|
A type of substitution that doesn't break transclusion, see wikipedia:Help:Substitution#The safesubst: modifier. |
Parameters
MediaWiki allows parameters to be passed to a template when it is transcluded. There are three ways to pass parameters: anonymously, by number, and by name.
To pass in anonymous parameters to a template, list the values of those parameters sequentially:
{{Thankyou|all your effort|Joe}}
Inside the template these parameters can be accessed by number:
{{{1}}}
→ all your effort{{{2}}}
→ Joe
To pass in parameters by number, identify each parameter when passing it:
{{Thankyou|2=Joe|1=all your effort}}
The third way of passing parameters is by name, instead of numbers.
{{Thankyou|signature=Joe|reason=all your effort}}
Inside the template these parameters can be accessed by name:
{{{signature}}}
→ Joe{{{reason}}}
→ all your effort
The advantage of using named parameters in your template, besides also being flexible in the order parameters can be passed, is that it makes the template code much easier to understand if there are many parameters.
Default values
It is possible to define default values for parameters in case no value is passed in. The syntax to retrieve a parameter using a default value is:
{{{ParameterName|DefaultValue}}}
The default parameter can be ommitted, in which case it defaults to an empty string:
{{{ParameterName|}}}
Control template inclusion
Anything between <noinclude>
and </noinclude>
will be displayed only when the template page is viewed directly.
Possible applications are:
- Categorising templates
- Explanatory text about how to use the template.
To give usage information, include an example like this one on the template page:
<noinclude> == Usage == {{Thankyou|reason=your reason|signature=your signature}} </noinclude>
The converse is <includeonly>
. Text between <includeonly>
and </includeonly>
will be processed and displayed only when the page is being included. The obvious application is to add all pages containing a given template to a category, without putting the template itself into that category. Notw: When you change the categories applied by a template, the categorization of the pages that use that template may not be updated until some time later.
Organizing templates
For templates to be effective, users need to find them, and find out how to use them. For a list of all templates, see Special:Allpages/Template:.
See also
- mw:Help:Template – contains a manual on how templates function
- mw:Help:Embed page – embedding pages from namespaces other than
Template:
. - wikipedia:Help:Templates
Redirects
Redirects are used to forward users from one page name to another. They can be useful if a particular article is referred to by multiple names, or has alternative punctuation, capitalization or spellings.
Creating a redirect
You may start a new page with the name you want to direct from (see Starting a new page). You can also use an existing page that you are making inactive as a page by going to that page and using the "edit" tab at the top. In either case, insert the following code at the very start of the Edit window for the page:
#REDIRECT [[pagename]]
where pagename is the name of the destination page. There must be no space before the "#" symbol. Any text before the code will disable the code and prevent a redirect.
Double redirects
A double redirect is a page redirecting to a page which is itself a redirect, and it will not work. Instead, people will be presented with a view of the next redirect page. This is a deliberate restriction, partly to prevent infinite loops, and partly to keep things simple. Double redirects should be eliminated by changing them to be 1-step redirects instead. Use the "what links here" toolbox link to find double redirects to a particular page, or use Special:DoubleRedirects to find them throughout the whole wiki.
A redirect to a page in the category namespace
To prevent a page that redirects to a category from appearing in the category, precede the word "Category" with a colon:
#REDIRECT [[:Category:Glossary]]
See also
Magic Words
Magic words are strings of text that MediaWiki interprets as a value or function. Page-dependent magic words will affect or return data about the current page (by default), even if the word is added through a transcluded template or included system message.
Behavior switches
A behavior switch controls the layout or behaviour of the page and can often be used to specify desired omissions and inclusions.
Word | Description |
---|---|
__NOTOC__
|
Hides the table of contents (TOC). |
__FORCETOC__
|
Forces the table of contents to appear at its normal position (above the first header). |
__TOC__
|
Places a table of contents at the word's current position (overriding __NOTOC__ ). If this is used multiple times, the table of contents will appear at the first word's position.
|
__NEWSECTIONLINK__
|
Adds a link ("+" by default) beside the "edit" tab for adding a new section on a non-talk page (see Adding a section to the end). |
__NOINDEX__
|
Tell search engines not to index the page (ie, do not list in search engines' results). |
Variables
Variables return information about the current page, wiki, or date. Their syntax is similar to templates.
Technical metadata
Revision variables return data about the latest edit to the current page, even if viewing an older version of the page.
Variable | Output | Description |
---|---|---|
Site | ||
{{SITENAME}}
|
Nottinghack Wiki | The wiki's site name. |
{{SERVER}}
|
https://wiki.nottinghack.org.uk | Domain URL. |
{{SERVERNAME}}
|
wiki.nottinghack.org.uk | Domain name. |
{{SCRIPTPATH}}
|
Relative path to the wiki scripts on the server. | |
{{STYLEPATH}}
|
/skins | Relative path to the wiki style sheet on the server. |
{{CURRENTVERSION}}
|
1.42.1 | The wiki's MediaWiki version. |
Latest revision to current page | ||
{{REVISIONID}}
|
14722 | Unique revision ID |
{{REVISIONDAY}}
|
20 | Day the edit was made (unpadded number) |
{{REVISIONMONTH}}
|
12 | Month the edit was made |
{{REVISIONYEAR}}
|
2018 | Year the edit was made |
{{REVISIONTIMESTAMP}}
|
20181220111402 | Timestamp of the edit |
{{REVISIONUSER}}
|
Jon | The user who made the most recent edit to the page, or the current user when previewing an edit |
{{PROTECTIONLEVEL:action}}
|
protection level | The protection level (e.g. 'autoconfirm', 'sysop') for a given action (e.g. 'edit', 'move') on the current page or an empty string if not protected. |
Affects page content | ||
{{DISPLAYTITLE:title}}
|
Format the current page's title. The value must be equivalent to the default title: only capitalization changes and replacing spaces with underscores are allowed. | |
{{DEFAULTSORT:sortkey}} {{DEFAULTSORTKEY:sortkey}} {{DEFAULTCATEGORYSORT:sortkey}}
|
Used for categorizing pages, sets a default category sort key. For example if you put {{DEFAULTSORT:Smith, John}} at the end of John Smith, the page would be sorted under "S" by default in categories.
|
Statistics
Numbers returned by these variables normally contain separators (commas or spaces, depending on the local language), but can return raw numbers with the ":R" flag (for example, {{NUMBEROFPAGES}}
→ 5,471 and {{NUMBEROFPAGES:R}}
→ 5471). Use "|R" for magic words that require a parameter like PAGESINCATEGORY (for example {{PAGESINCATEGORY:Help}}
and {{PAGESINCATEGORY:Help|R}}
). Also applicable to {{PAGESIZE:page name}}
above.
Variable | Output | Description |
---|---|---|
Entire wiki | ||
{{NUMBEROFPAGES}}
|
5,471 | Number of wiki pages. |
{{NUMBEROFARTICLES}}
|
974 | Number of pages in content namespaces. |
{{NUMBEROFFILES}}
|
2,656 | Number of uploaded files. |
{{NUMBEROFEDITS}}
|
28,883 | Number of page edits. |
{{NUMBEROFVIEWS}}
|
Template:NUMBEROFVIEWS | Number of page views. Usually useless on a wiki using caching. |
{{NUMBEROFUSERS}}
|
354 | Number of registered users. |
{{NUMBEROFADMINS}}
|
19 | Number of users in the sysop admin group. |
{{NUMBEROFACTIVEUSERS}}
|
21 | Number of active users, based on the criteria used in Special:Statistics. |
{{NUMBERINGROUP:groupname}} {{NUMINGROUP:groupname}}
|
Number of users in a specific group. |
Page name variables
Variable | Output | Description |
---|---|---|
{{FULLPAGENAME}}
|
User:Marcus/MediaWiki Quick Reference | Namespace and page title. |
{{PAGENAME}}
|
Marcus/MediaWiki Quick Reference | Page title. |
{{BASEPAGENAME}}
|
Marcus | Page title excluding the current subpage and namespace. For more complex splitting, use {{#titleparts:}} .
|
{{SUBPAGENAME}}
|
MediaWiki Quick Reference | The subpage title. |
{{SUBJECTPAGENAME}}
|
User:Marcus/MediaWiki Quick Reference | The namespace and title of the associated content page. |
{{TALKPAGENAME}}
|
User talk:Marcus/MediaWiki Quick Reference | The namespace and title of the associated talk page. |
The following are equivalents encoded for use in MediaWiki URLs (i.e. spaces replaced with underscores and some characters percent-encoded):
{{FULLPAGENAMEE}}
{{PAGENAMEE}}
{{BASEPAGENAMEE}}
{{SUBPAGENAMEE}}
{{SUBJECTPAGENAMEE}}
{{TALKPAGENAMEE}}
These can all take a parameter allowing specification of the page to be operated on, instead of just the current page:
{{PAGENAME:Template:Main Page}}
→ Main Page
Namespace variables
Variable | Output | Description |
---|---|---|
{{NAMESPACE}}
|
User | Name of the page's namespace |
{{SUBJECTSPACE}} {{ARTICLESPACE}}
|
User User |
Name of the associated content namespace |
{{TALKSPACE}}
|
User talk | Name of the associated talk namespace |
The following are equivalents encoded for use in MediaWiki URLs (spaces replaced with underscores and some characters percent-encoded):
{{NAMESPACEE}}
{{SUBJECTSPACEE}}
{{TALKSPACEE}}
These can take a page name instead of operating on the current page:
{{NAMESPACE:Template:Main Page}}
→ Template{{SUBJECTSPACE:Template:Main Page}}
→ Template{{TALKSPACE:Template:Main Page}}
→ Template talk
Parser functions
Parser functions have the same syntax as templates. The names are sometimes prefixed with a hash to distinguish them from template page names.
Conditional expressions
#if
This function tests whether the first parameter is non-empty. It evaluates to false if the test string is empty or contains only whitespace characters (spaces, newlines, etc).
{{#if: test string | value if true | value if false }}
#ifeq
This parser function compares two strings and determines whether they are identical.
{{#ifeq: string 1 | string 2 | value if identical | value if different }}
#iferror
This function evaluates to true if the input string contains an HTML object with class="error", as generated by other parser functions such as #expr, #time and #rel2abs, template and errors such as loops and recursions.
{{#iferror: test string | value if error | value if correct }}
#ifexpr
This function evaluates a mathematical expression and returns one of two strings depending on the boolean value of the result:
{{#ifexpr: expression | value if true | value if false }}
#ifexist
This function returns one of two values depending on whether a page exists on the local wiki.
{{#ifexist: page title | value if the page exists | value if it doesn't exist }}
#switch
This function compares one input value against several test cases, returning an associated string if a match is found.
{{#switch: comparison string | case1 = result1 | case2 = result2 | ... | caseN = resultN | default result0 }}
#expr
This function evaluates a mathematical expression and returns the calculated value. See metawikipedia:Help:Calculation for details of operators and constants.
{{#expr: expression }}
URL data
Parser function | Input → Output | Description |
---|---|---|
{{localurl:page name}} {{localurl:page name|query_string}}
|
{{localurl:MediaWiki}} → /wiki/MediaWiki{{localurl:MediaWiki|printable=yes}} → /index.php?title=MediaWiki&printable=yes
|
The relative path to the title. |
{{fullurl:page name}} {{fullurl:page name|query_string}} {{fullurl:interwiki:remote page name|query_string}}
|
{{fullurl:Category:Top level}} → https://wiki.nottinghack.org.uk/wiki/Category:Top_level
|
The absolute path to the title. This will also resolve Interwiki prefixes. |
{{filepath:file name}} {{filepath:file name|nowiki}}
|
{{filepath:Example.jpg}} → https://wiki.nottinghack.org.uk/images/a/a9/Example.jpg |
The absolute URL to the full size media file. |
{{#rel2abs: path }} {{#rel2abs: path | base path }}
|
{{#rel2abs:.}} → User:Marcus/MediaWiki Quick Reference{{#rel2abs:.|Help:Contents}} → Help:Contents
|
Converts a relative file path into an absolute filepath. In path</path> the following syntax is valid:
|
Date and time functions
Variable | Output | Description |
---|---|---|
{{#timel: Y F d, h:i:s}}
|
2024 November 23, 03:01:34 | Displays the current time and date in the local timezone of the wiki. Due to caching, these variables frequently show when the page was cached rather than the current time. |
Namespace functions
{{ns:}}
returns the localized name for a namespace. {{nse:}}
is the equivalent encoded for MediaWiki URLs. It does the same, but it replaces spaces with underscores, making it usable in external links.
Content namespaces | Talk namespaces | |||
---|---|---|---|---|
Usage | Output | Usage | Output | |
{{ns:-2}} or {{ns:Media}}
|
Media | |||
{{ns:-1}} or {{ns:Special}}
|
Special | |||
{{ns:0}} or {{ns:}}
|
{{ns:1}} or {{ns:Talk}}
|
Talk | ||
{{ns:2}} or {{ns:User}}
|
User | {{ns:3}} or {{ns:User talk}}
|
User talk | |
{{ns:4}} or {{ns:Project}}
|
Nottinghack Wiki | {{ns:5}} or {{ns:Project talk}}
|
Nottinghack Wiki talk | |
{{ns:6}} or {{ns:File}} or {{ns:Image}}
|
File | {{ns:7}} or {{ns:File talk}} or {{ns:Image talk}}
|
File talk | |
{{ns:8}} or {{ns:MediaWiki}}
|
MediaWiki | {{ns:9}} or {{ns:MediaWiki talk}}
|
MediaWiki talk | |
{{ns:10}} or {{ns:Template}}
|
Template | {{ns:11}} or {{ns:Template talk}}
|
Template talk | |
{{ns:12}} or {{ns:Help}}
|
Help | {{ns:13}} or {{ns:Help talk}}
|
Help talk | |
{{ns:14}} or {{ns:Category}}
|
Category | {{ns:15}} or {{ns:Category talk}}
|
Category talk |
Formatting functions
Usage | Input → Output | Description |
---|---|---|
{{lc:string}}
|
{{lc:DATA CENTER}} → data center
|
The lowercase input. |
{{lcfirst:string}}
|
{{lcfirst:DATA center}} → dATA center
|
The input with the first character lowercase. |
{{uc:string}}
|
{{uc:text transform}} → TEXT TRANSFORM
|
The uppercase input. |
{{ucfirst:string}}
|
{{ucfirst:text TRANSFORM}} → Text TRANSFORM
|
The input with the first character uppercase. |
{{padleft:xyz|stringlength}} {{padleft:xyz|strlen|char}} {{padleft:xyz|strlen|string}}
|
{{padleft:xyz|5}} → 00xyz{{padleft:xyz|5|_}} → __xyz {{padleft:xyz|5|abc}} → abxyz {{padleft:xyz|2}} → xyz{{padleft:|1|xyz}} → x (first character of the string) |
Inserts a string of padding characters (parameter 3) of a specified length (parameter 2) next to a chosen base character or variable (first parameter). The final digits or characters in the base replace the final characters in the padding. The padding string may be truncated if its length does not evenly divide the required number of characters. |
{{padright:xyz|stringlength}} {{padright:xyz|strlen|char}} {{padright:xyz|strlen|string}}
|
{{padright:xyz|5}} → xyz00
|
Identical to padleft, but adds padding characters to the right side. |
{{plural:2|is|are}}
|
{{plural:0|is|are}} → are{{plural:1*1|is|are}} → is{{plural:21 mod 10|is|are}} → are{{plural:{{#expr:21 mod 10}}|is|are}} → is{{plural:1|is|are}} → is{{plural:2|is|are}} → are
|
Outputs the singular form (second parameter) if the first parameter is an expression equalling one; the plural form (third parameter) otherwise. Plural transformations are used for languages like Russian based on "count mod 10". |
{{#titleparts: pagename | number of segments to return | first segment to return }}
|
|
Separates a pagetitle into segments based on slashes, then returns some of those segments as output. If the number of segments parameter is not specified, it defaults to "0", which returns all the segments. If the first segment parameter is not specified or is "0", it defaults to "1":
|
Miscellaneous functions
Usage | Output | Description |
---|---|---|
{{#special:special page name}}
|
Special:Special page name Special:UserLogin |
The localized name for the given Special: page. |
{{gender:username
|
(depends on the named user's gender) | A switch for the gender set in Special:Preferences Note: If 3rd parameter is omitted and user hasn't defined his/her gender, then |
Managing files and pages
Starting a new page
When a link points to an article that doesn't exist yet, the link will be coloured red. Clicking a red link will take you to the edit page where you can submit the new article. Usually this is the best way to create a new page, because it means that right from the start the page will be linked from at least one other place on the wiki. Normally there is no reason to create a page without first creating a red link to it. An alternative is to search for a page that doesn't exist (using the search box), which will provide a link to create a new stand-alone page.
Copying a page
There is no facility to copy a page in MediaWiki, so you must copy and paste the wikitext. It is not possible to copy the edit history from one page to another.
Moving (renaming) a page
The name of a page can be changed by using the "move" tab at the top. This tab is only visible if you are logged in. By using this feature, you also move the editing history of the page, which allows people to see how the contents of the page were built up, and who contributed what. Because the move operation leaves behind a redirect (see Redirects), it should not result in any broken links, however you might want to find pages which link to the old title, and change their text to link directly to the new title (see Unlinking a page).
Deciding on a page title can be a difficult aspect of wiki organization, and one which can provoke debates. If the move could be considered controversial, you should propose the move first (see Project:Propose a page move).
As with all wiki editing, a move operation can be reversed. To reverse a move operation, simply move the page back to the previous name. If a page is renamed from "A" to "B" and then back to "A", a page with the title "B" will still be left behind, as a redirect from "B" to "A". To remove this page see deleting a page). Alternatively, users with the suppressredirect
permission will see the option to move a page without creating a redirect.
Deleting a page
Normal users cannot permanently delete a wiki page. This is a deliberate design feature; every kind of editing operation can be reverted and that includes resurrecting deleted pages. If for some reason you need a page to be deleted urgently, please see Project:Mark a page for deletion. For any other deletion that might be controversial or disruptive, you should propose the change first (see Project:Propose a page deletion).
Unlinking a page
The "What links here" feature in the Tools (at the bottom of the sidebar) will tell you which other Wiki pages link to the current page. Always use this feature to check before deleting a page. These related pages will need to be edited for their links to reflect the change.
System Information
Nottinghack Wiki is running MediaWiki 1.42.1
. See:
- Detailed version information and the list of extensions
- The Interwiki Table
- Usage statistics
- The gallery or list of recently uploaded files.
- Unused files that might not be needed.
- Other SpecialPages
See also
- A shorter wiki markup reference on Wikipedia.