Help:Editing/Advanced techniques

From Pikipedia, the Pikmin wiki
Jump to navigation Jump to search

These are some additional features of MediaWiki code that can be used in articles. For more basic techniques, see Help:Editing.

Formatting[edit]

To make a line across the page, use four hyphens:

----

To display plain text that is pre-formatted, preserving the line breaks it has, use the <pre> tag:

<pre>Everything in here
retains the line breaks
it has.</pre>

To embed a video (see Help:Files#Videos for more details):

{{#ev:service|id}}

If a display of wiki coding is wanted, use the "nowiki" HTML-like tag around the code. The following produces the text "[[Main Page]]" rather than creating a link:

<nowiki>[[Main Page]]</nowiki>

If you do not wish to include something on a page but want it on another page that includes that page, add "includeonly" tags around the code:

<includeonly>code to be included only</includeonly>

Similarly, information in "noinclude" tags is only displayed on the original page:

<noinclude>this is not included in pages that include this one</noinclude>

As well as this, a fair amount of HTML is functional. Tags such as <span> and <div> can be given a style attribute to add some CSS, in the form <span style="CSS here"/>content</span>.

Links[edit]

To link to a page in another wiki, place its interwiki prefix at the start of the link. This prefix is not necessarily the wiki's title; a full list can be found at Special:Interwiki. Pikmin Fanon's main page, for example, is found here:

[[fanon:Main Page]]

To add an external link (a link to a website outside of NIWA, MediaWiki, Wikipedia and a few others), use single square bracket. It is necessary to include the prefix (http://, https://, ftp://, irc://, etc.):

[http://web_address]

Again, it is possible to change the displayed text. This time, however, simply leave a space between the address and the text. The following example displays Google link:

[http://google.com Google link]

Media[edit]

This includes images and audio files. To include them on pages, link to them as you would an article. As with categories, adding a colon before the namespace creates a link rather than showing the media.

  • To show an image:
[[File:image name]]
  • To link to the description page of an image.
[[:File:image name]]
  • To link to the image file itself rather than the description page:
[[Media:image name]]

Arguments[edit]

As with links, arguments are separated by pipe ("|") characters, all placed within the square brackets. For starters, it is possible to display the image at a different width. This measurement requires a unit: use pixels, abbreviated "px".

  • To show an image at a width of 300 pixels:
[[File:image name|300px]]

To display a frame around an image, pass frame as an argument; images included like this cannot be resized. To give an image a frame and resize it, you want a thumbnail: use thumb. By default, thumbnails are displayed at the size set in the user's preferences (or the original image size, if smaller), so it is recommended not to define a width.

Images with frames can be given captions, by passing the text of the caption to display as an extra argument.

  • Thumbnail image with the caption "this is an image":
[[File:image name|thumb|this is an image]]

The alignment of images is important to the layout of the page. The default value for this argument is none, which leaves the image "inline": it is displayed in line with text in the same paragraph. Images with frames, on the other hand, are "floated" right by default: float images with left or right, to make text and other inline or floated elements of the page flow around the image. Finally, center centers an image on the page, making text before and after it leave a gap to either side, instead of flowing around.

  • Centred image with a width of 350 pixels:
[[File:image name|350px|center]]
  • Image in a frame, displayed in line with text, with the caption "inline image":
[[File:image name|frame|none|inline image]]

The order of arguments is flexible, to some degree; measurements are interpreted as widths, for example. Follow the examples throughout this section for a guide as to what can work, and if the result isn't looking like you expected, try switching arguments around.

Templates and inclusions[edit]

Any page can be included in another page by way of enclosing it in double curly parentheses. Write the page name as you would in a link. This includes everything on that other page wherever the code is put:

{{namespace:Page name to be included}}

When a number of pages need similar information or layouts, templates are used, which are pages in the Template namespace created to be included in other pages. They make pages shorter and remove complex code, and allow many pages to be altered at the same time. If a namespace is not supplied in the inclusion code, Template is used by default; to include a page in the main namespace, use {{:Page name}}.

It is possible to pass information to templates when including them, which make the content displayed different. These are either named or numbered, and used as follows:

{{Template name|a piece of information|another piece of information}}

In the template, these are referred to as "{{{1}}}", "{{{2}}}" and so on, and can be put anywhere, as if they were text or code. For example, the following template, included as above, would display "This template contains a piece of information and another piece of information.":

This template contains {{{1}}} and {{{2}}}.

These can be named to make things easier to follow:

Template:

My name is {{{name}}} and I am {{{age}}} years old.

Code:

{{Template name|name=Bob|age=5}}

Result:

My name is Bob and I am 5 years old.

Magic words[edit]

So-called "magic words" are pieces of code that affect the layout of a page; here are a few of the commoner ones. Note that there are two underscores on either side of each:

Code Effect
__NOTOC__ Hides the table of contents (ToC)
__TOC__ Forces the ToC to appear where the word is placed
__FORCETOC__ Forces the ToC to appear in the normal place for a page with any number of sections
__NOEDITSECTION__ Removes 'edit' links on sections
__NOGALLERY__ Replaces image thumbnails with links in categories
__END__ Forces the page to end there, allowing extra lines at the end of the page
__HIDDENCAT__ Hides category the word is placed on from the footer of pages in it