Brighter Shores:Style guide/Wiki code

Revision as of 13:39, 14 November 2024 by BlackHawk (talk | contribs) (Created page with "The '''wiki code style''' part of the style guide is a set of guidelines to work towards when cleaning up the wiki code used in articles. These guidelines are not an obligation during general editing, but serve as a common ground for the specific task of keeping the wiki code clean and consistent. ==White-spacing== ===Trailing spaces=== Do not allow trailing spaces at the end of lines or paragraphs. The only exception to this is a single trailing space following the '='...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The wiki code style part of the style guide is a set of guidelines to work towards when cleaning up the wiki code used in articles. These guidelines are not an obligation during general editing, but serve as a common ground for the specific task of keeping the wiki code clean and consistent.

White-spacing Edit

Trailing spaces Edit

Do not allow trailing spaces at the end of lines or paragraphs. The only exception to this is a single trailing space following the '=' of a parameter without a value in a block-style template, so that a space is already present when the value is filled in later on.

Multiple spaces Edit

Only a single space should be used between the end of one sentence and the beginning of the next, and between words.

Styling/tags Edit

There should be no spaces between text styling wiki syntax elements or HTML tags and their content. If the styling only surrounds a fraction of a full block, spaces should be on the outside of the styling. Use:

This is '''bold''' and <span style="color:red;">red</span>.

instead of:

This is '''bold '''and<span style="color:red;"> red</span>.

Line break tags Edit

When <br> tags are used, they should not be surrounded by spaces but immediately follow/precede the content that is broken into two lines. When used in a paragraph, the tag should be followed by an actual new line.

Templates Edit

Inline Edit

Inline templates should not have spaces between the pipe ('|') symbol and the parameter name (or value), nor before or after the '=' sign.

{{DropsLine|PARAMETER1=VALUE1|PARAMETER2=VALUE2}}
{{Otheruses|PARAM_VAL1|PARAM_VAL2|PARAM_VAL3}}

Block Edit

Block templates should have each parameter on a new line, with no space between the pipe symbol and the parameter name or value. The '=' symbol should be surrounded by a single space on each side. The final '}}' should be on a separate line.

{{Infobox Item
|PARAMETER = VALUE
|PARAMETER2 = VALUE1
}}

List Edit

There should be a single space between a list character (* or #) and the content of that list item.

* List1
*# Sublist
* List2

Section headers Edit

There should be no spaces between the '=' signs used as wiki syntax for the section headers and the content of the header.

==HEADER==

Blank lines Edit

General Edit

Paragraphs should only be separated by a single blank line; if for some formatting reason a wider gap is required, use the {{Clear}} template as necessary. The clear template should be on its own line. Example:

Paragraph 1

{{Clear}}
Paragraph 2

If the formatting issue is caused by a right-floating element (such as an infobox), the clear template should generally have the value right; for left-floating elements (like chatheads), left.

A section header should always be preceded by a blank line, except if the previous line with content is another section header, or if the previous line is a {{Clear}} for formatting purposes and is preceded by a blank line. A section header should never be followed by a blank line. As with the detail and chathead images just after an infobox, if the first line after a section header is a (group of) file(s), or a simple text-template such as {{Main}}, it should not be followed by a blank line before the next paragraph.

There should be no blank line between a <references /> tag and its preceding table, if applicable; nor between the last trivia bullet.

Language links and categories should not be separated by blank lines. They should also follow the last content part of the article without any blank lines separating them, regardless of what that last bit of content is (text, list, table, template, ...).

Template grouping Edit

There should be no blank line between the 'header templates', the infobox, and the first paragraph. 'Header templates' are the grouping of all templates that are generally put at the very top of an article (RSC/2007scape links, otheruses, strategy, dual wield, ...). There should be no blank lines between navboxes, nor between templates that belong together (such as drop table templates). Reflist tags should be separated by a blank line from following navboxes, even if they are not preceded by their own section header.

Lists Edit

Lists should be followed by a blank line. On disambig pages the listing should always be preceded by a blank line.

Orders Edit

Special tags Edit

DISPLAYTITLE should be placed at the very top of the page, prior to any actual article content. At the bottom of the page DEFAULTSORT should be placed just prior to any language links (or categories). In both cases no blank lines should precede or follow these tags, and each tag should be placed on its own line. __NOTOC__ should be placed before the first section header, without a blank line in between them. All other behaviour switch magic words should be at the top of the page before DISPLAYTITLE; however, this should almost never occur.

Template order Edit

The following order should be followed for 'header templates'. Each template should start on a new line:

<<Templates that redirect away from the current page: otheruses, redirect, variant, ...>>
<<Box templates that are about the current article: future, ...>>
<<Remaining templates about the current article that generally are simple (italics) text: ...>>

Tables Edit

In the mainspace, tables should always be created using the wiki syntax instead of using HTML tags. In other namespaces (specifically Template: and Module:) it might be required to use the HTML tags instead.

Except for very simple tables, multi-line row formatting should be preferred, where each cell starts on its own line.

Formatting Edit

Tables in mainspace articles should always have the class "wikitable", unless there is a specific reason why this is omitted. CSS classes for tables should be placed in the following order:
wikitable, sortable, lighttable, mw-collapsible, mw-collapsed/uncollapsed

If present, the table header should be the first thing following the table opening.

The order that should be used for any style and attributes applied to a table, cell or row is:
id, class, rowspan, colspan, style

White-spacing Edit

A space should be placed between each table syntax element and table content, styling, and attributes. Empty cells should not contain anything, even a space, with the exception of an empty cell in the single-line row formatting as long as this is not the last cell of the row. In this case a single space should separate both cell boundary syntax elements.

Below are examples of the expected placement of white-spacing in both formats.

Single-line row Edit

{| class="wikitable"
! Small table h1 !! h2
|-
| Cell1 ||
|}

Multi-line row Edit

{| class="wikitable"
|+ Table header
|-
! Header cell 1
! id="header2" colspan="2" | Header cell 2
|-
| Content cell 1
| Content cell 2
|
|}

HTML and wiki tags Edit

HTML5 should be used in preference to older specifications (HTML 4, XHTML, etc.). For example, prefer <br> to <br />. Although MediaWiki's tags (such as <references>) are not HTML, their usage should follow the same set of guidelines as HTML tags. This also implies:

  • Surround all attribute values by double quotation marks: use <references name="g" /> instead of <references name=g />.
  • Separate attribute values by a space, but do not put a space around the = between attributes and their values: <references name="g" group="d" />' instead of <references name="g"group = "d" />.
  • Style attributes should contain no spaces surrounding the : between the style's property and its value. Each style property-value combination should be terminated by a ;, even if there is only a single pair, and a space should separate multiple property-value combinations: <span style="color:red; background:yellow;"> instead of <span style="color : red;background: yellow">.
  • There should be no space between the last part of a tag and the closing '>', except in the case of a self-closing tag. For self-closing tags, a single space should precede the />: use <references name="g" /> instead of <references name="g"/>.
  • Prefer using CSS over deprecated HTML tags.
  • When appropriate wiki syntax elements exist, they should be used in lieu of equivalent HTML tags: use '''BOLD''' instead of <b>BOLD</b>.

Number formatting Edit

Always include thousand separators in any numbers above 999 (and below -999), with the exception of in the year of a date (for both real dates and an ingame lore date) and for numbers that are template parameter values, which the template will automatically format (convert value of an Infobox Item, quantity of a DropsLine, ...).

Image captions Edit

Non-thumbnail/framed images should generally not contain a caption. Use:

[[File:Bucket.png|left]]

instead of:

[[File:Bucket.png|left|An image of a bucket]]

Example page Edit

Below are examples of the above guidelines in action, for a stub version of an average article.

Normal page Edit

__BEHAVIOURSWITCH__
{{DISPLAYTITLE:Different title}}
{{Hatnote|PARAM_VAL1|PARAM_VAL2|PARAM_VAL3}}
{{Box template}}
{{Infobox name
|PARAMETER = VALUE
|PARAMETER2 = VALUE1
}}
'''Subject''' has information in lead paragraph.

__NOTOC__
==First heading==
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

{| class="wikitable sortable mw-collapsible mw-collapsed"
|+ Table header
|-
! Header cell 1
! id="header2" colspan="2" style="text-align:right;" | Header cell 2
|-
| Content cell 1<ref group="n" name="foo">Foobar baz, Gaz.</ref>
| Content cell 2<ref group="n" name="foo" />
|
|}
<references group="n" />

{| class="wikitable"
|+ Small table
! h1 !! h2
|-
| Cell1 ||
|}

{{Clear|left}}
==Second heading==
===Sub heading===
[[File:FILE|thumb]]
PARAGRAPH<br>
New line, same paragraph.

* Item
* Item

==Drops==
{{DropsTableHead}}
{{DropsLine|PARAMETER1=VALUE1|PARAMETER2=VALUE2}}
{{DropsTableBottom}}

==Trivia==
* Trivia

==References==
{{Reflist}}

{{Navbox}}
{{DEFAULTSORT:Key}}
[[Category:CATEGORY]]

Disambiguation page Edit

'''TERM''' may refer to:

* Item
* Item

{{Disambig}}