Tesseract:Style guide/Wiki code

From the Tesseract Wiki, the wiki for all things Marvel Cinematic Universe
Jump to navigation Jump to search

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 source]

Trailing spaces[edit source]

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 source]

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 source]

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 source]

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 source]

Inline[edit source]

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


Block[edit source]

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

List[edit source]

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

* List1
*# Sublist
* List2

Section headers[edit source]

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


Blank lines[edit source]

General[edit source]

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

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 source]

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. 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 source]

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

Orders[edit source]

Special tags[edit source]

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 behavior switch magic words should be at the top of the page before DISPLAYTITLE; however, this should almost never occur.

Template order[edit source]

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, ...>>
<<Box templates that are about the current article ...>>
<<Remaining templates about the current article that generally are simple (italics) text: official world, ...>>

Tables[edit source]

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 source]

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 source]

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 source]

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

Multi-line row[edit source]

{| 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 source]

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 source]

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 inuniverse lore date) and for numbers that are template parameter values, which the template will automatically format.

Image captions[edit source]

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


instead of:

[[File:Thanos.png|left|An image of Thanos]]

Example page[edit source]

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

Normal page[edit source]

{{DISPLAYTITLE:Different title}}
{{Box template}}
{{Infobox name
'''Subject''' has information in lead paragraph.

==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
| Content cell 2

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

==Second heading==
===Sub heading===
New line, same paragraph.

* Item
* Item

<references group="d" />

* Trivia


[[zxx:lang link]]

Disambiguation page[edit source]

'''TERM''' may refer to:

* Item
* Item