Wikicode

From /tg/station 13 Wiki
Revision as of 07:51, 7 March 2022 by SpaceSmithers (talk | contribs) (→‎Page Links: Linking with #tab_name will open the page with the specified tab opened, similar to linking a header.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Wikicode

Wikicode is the strange syntax used by all wikipedias including this one. If you don't know it and are prepared to learn, continue reading. Otherwise, you can read the Wikipedia help page Here, or read the MediaWiki help page here.

This page is meant to be a much shorter list than one you would find on wikipedia, and also meant for some of our own internal templates or similar tools. Really, this will be some kind of list of some basic/advanced formatting techniques and how to use them.

Page Links

Page links are important because without them, finding pages becomes too hard. Linking to other pages minimizes the total amount of information needed on one page, but also chains pages together for ease of access. Note, any time a page has spaces in the title, they must be replaced with underscores {_} The easiest method to link to another page on our wiki is to use [[A_page_name]]. For example:

This Gives us this
This will direct you to the [[Engineer]] page.

This will direct you to the Engineer page.


But lets say you want to link to a specific header or part of the page. Instead, we add a # symbol with the header name. like this: [[Name_of_page#Header]]. An example:

This Gives us this
This will direct you to the [[Engineer#Doing_your_duty]] header.

This will direct you to the Engineer#Doing_your_duty header.


This method also works for pages that use tabs. An example:

This Gives us this
This will open the page with the [[Rules#Roleplay_Rules]] tab opened.

This will open the page with the Rules#Roleplay_Rules tab opened.


Alternatively, you can use an {{anchor}} on your page. The Anchor is a template that creates an invisible anchor on the page for linking. All you do is type {{Anchor|Name_of_Anchor}}, and all you need to do is make a link to the anchor. See the templates section for more info. An example:

This Gives us this
{{Anchor|donk}} This [[Wikicode#donk]] will bring you here.

This Wikicode#donk will bring you here.


In many cases, we don't want the actual page name to be in the link we make. So now we use [[Name_of_page|Name_of_link]]. An example:

This Gives us this
Doing your [[Engineer#Doing_your_duty|doody]]

Doing your doody


BYOND links

To create a BYOND hyperlink, use the <byond> tags. The specific syntax is <byond server=servername.com port=4000>Link text here</byond>.

Redirecting pages

In some cases, creating a blank page to redirect to a similar named page or object is helpful. This especially helps when using the search function on the wiki. To make a redirect, create a new page of the word you need redirected, and only enter #REDIRECT [[page_to_redirect_to]]. This makes it so whenever someone loads the page, they will be automatically redirected to the indicated page.

Headers

Headers separate the page into their respective sections (duh). As referenced earlier, headers can be linked to directly using the # symbol with the header name combined with the page name. ([[PageName#HeaderName]]) Headers are created by using the equals symbol (=) before and after a header name. For example:

This Gives us this
=Heading=

Heading


If you want to make a sub-section, all you have to do is add another set of equals (=) symbols.

Just

==Just==

Like

===Like===

This

====This====

Also, as you may have noticed at the top of most pages, there is a 'contents' menu. All of the headers and sub-headers are listed here for quick access.

Page Formatting

In most cases, just using the return/enter key and headers is good enough for a page. But sometimes, you just want to add some extra flair to your pages.

Text

Some text editing tools are built into the page editor. Some examples are:

This Gives us this This Gives us this
'''bold''' bold <small>Small text</small> Small text
''Italics'' Italics <big>Big text</big> Big text
<s>striking text</s> striking text <u>Underline</u> Underline

Other Than Text

<br> works similar to using the return/enter key, but sometimes works better. Forces the line of text to break off and leave space above it.

This Gives us this
Spacing out <br> your text

Spacing out
your text


Numbering and bullet points can also be used on a page without having to space it out. They both follow the same format, but use different symbols.

This Gives us this This Gives us this

# Line one
# Line two
## Sub
#: Continuing
Stopping
# Starting a new line

  1. Line one
  2. Line two
    1. Sub
    Continuing

Stopping

  1. Starting a new line

* Line one
* Line two
** Sub
*: Continuing
Stopping
* Starting a new line

  • Line one
  • Line two
    • Sub
    Continuing

Stopping

  • Starting a new line


Templates

Templates are exactly what they sound like; They are a predefined format for easy use. Similar to the anchor template listed earlier, templates are their own separate pages that are designed to only require variable data to be inserted. Most, if not all templates should have a detailed description of how to use it on its page. The currently used templates can be found here, and the currently unused templates can be found here. Note, just because a template is unused, doesn't mean it is useless. If you can find a use for one, use it! To use any template, you need to reference the name of it's page within double brackets {{}}, then define the variables. A good example of a useful template is the {{Item}} template. The {{Item}} template actually uses multiple templates within itself, but I won't go into much detail about that. When you want to use the {{Item}} template, paste the code from the page like so:

 {{Item
 |name=Test Item
 |bgcolor1 = #FFEE88
 |bgcolor2 = #FFDD66
 |image = Redtoolbox.png
 }} 

Then your template (in this case, our item box) shows on the page like so:

Test Item
Test Item


Basically, all this template did was define the Name, Background Color 1 (bgcolor1), Background Color 2(bgcolor2), and the Image. The name is simply text defined by the user, and the backgrounds are colors that you pick. You can also replace the #FFEE88 with the actual name of the color like orange, red, blue, and so on. The image variable calls out the picture file on the wiki (so first you have to upload it). Capitalization and the file extension are important for this! Otherwise the code will think you want a different file. Normally when you try to use a image or similar file with wikicode, you need to define it as a file first. Depending on how the template is built, it can put the "File:" in for you, so all you have to type is the name of the file itself.

Tables

Tables are a little tricky to cover in depth without taking up a ton of space. So for more detailed information, check out Wikipedia's table page here. Here.
Tables are similar to templates, mostly just because they are a type of coding that define stuff. Most templates end up using a table of some sort to make it look pretty anyways. An extremely simple table works like so:

{| class="wikitable" 
|-
! One || Two
|-
| Three || Four
|}

Gives us

One Two
Three Four

Each part of the code defines where it belongs and what it does. The {| and |} are the opening and closing brackets of our table, they indicate the start and the end. The class="wikitable" defines the style of the table borders. Instead, you could replace the class with border= and define the size and style of the border. The |- indicates the end of a row, and adding a new line after it will make an extra row beneath it. The ! defines the row to be a title of sorts, which also defaults the text to be centered in the box. In the case of the class="wikitable", it makes the row a different color. The || marks the end of the box, and any data past it will be in the next box over. To add more to a table, simple add a column with ||, or add a new row by making a new line and adding |- then another line and |.

{| class="wikitable" 
|-
! One || Two || Five 
|-
| Three || Four || Six
|-
| One || More || Time
|}
One Two Five
Three Four Six
One More Time
{| class="wikitable" || style="text-align: center;"
|-
|style="background: blue; color: white" | X ||style="background: blue; color: white" | One ||style="background: blue; color: white" | Two ||style="background: blue; color: white" | Three
|-
|style="background: blue; color: white" | One || 1  || 2 || 3
|-
|style="background: blue; color: white" | Two || 2 || 4 || 6
|-
|style="background: blue; color: white" | Three || 3 || 6 || 9
|}
X One Two Three
One 1 2 3
Two 2 4 6
Three 3 6 9

And a sortable table:

{| class="wikitable sortable" border="1"
|-
! scope="col" | *
! scope="col" | A
! scope="col" | B
! scope="col" class="unsortable" | C
! scope="col" class="unsortable" | D
|-
!E
| 1 || 4 || 2 || 6
|-
!F
| 2 || 8 || 4 || 1
|-
!G
| 0 || 4 || 1 || 2
|-
!H
| 3 || 6 || 9 || 1
|-
|}
* A B C D
E 1 4 2 6
F 2 8 4 1
G 0 4 1 2
H 3 6 9 1

Images

Unless you put an external link to an image on a image hosting site, you will be using images uploaded to the wiki. Mostly GIF and PNG formats are preferred. The best way to get an image from the game is to download the Source Code, and export the image. Images can be placed by placing [[File:Example.png]]. An example:

This Gives us this
[[File:Generic_engineer.png]] Generic engineer.png

When you simply call up an image, it will be in it's full sized format. Resizing the image is not simple anymore. Adding |thumb after the file name forces it to be a thumbnail size. If the image is already smaller than the thumbnail size, then the image will not be re-sized. Also, the image will be placed in a frame (which you can add without making the image a thumbnail by adding |frame instead) and default to the right side of the page. The location of the image can also be changed by adding |left or |center.

This Gives us this
[[File:Generic_engineer.png|thumb|left]]
Generic engineer.png


Sometimes the thumb is too big or too small. So instead, you can replace |thumb with |30px, where the 30 can be any sized number (assuming you don't want it larger than an average screen). The px stands for pixels, and does not need to be changed. For some reason the wiki seems to have issues shrinking images, so I have no clue how to properly thumbnail other than uploading a separate smaller version of the image.


When any image is placed on a page, clicking the picture will take you to another page. The default setting takes you to the images page, where you can view the upload history of that specific image. By adding a |link=www.example.com or |link=Engineering, you can make the image link to another internal or external page. Also, adding text such as |text goes here adds a small pop-up dialog that shows the defined text.

This Gives us this
[[File:locker.png|link=Storage_items#Lockers|This is a locker]] This is a locker


Hiding/collapsing content

Add "mw-collapsed" to the class to have it start collapsed. See examples 1 and 3.

Example 1: Table

{| class="mw-collapsible mw-collapsed wikitable"
! The header || remains visible
|-
| This content || is hidden
|-
| at first || load time
|}

The header remains visible
This content is hidden
at first load time

Example 2: Text

<div class="toccolours mw-collapsible" style="width:400px">
This text is collapsible. {{Lorem}}
</div>

This text is collapsible.


[Show/hide] Example 3: Section

Text

Text


== <span class="mw-customtoggle-0" style="font-size:small; display:inline-block; float:right;"><span class="mw-customtoggletext">[Show/hide]</span></span> Example 3: Section ==
<div id="mw-customcollapsible-0" class="mw-collapsible mw-collapsed">
Text
Text
</div>


Hosting Hosting a serverSetting up the databaseWorking with /tg/station as an upstream repository
Contributing Guide to contributing to the gameSetting up gitDownloading the source codeReporting issuesChangelogs
Coding Understanding SS13 codeSS13 for experienced programmersCode docsCoding standardsGetting Your Pull AcceptedBinary flags‎Text FormattingMySQL
Mapping Guide to mappingMap mergerGuide to door access
Spriting Guide to spritingResolving icon conflicts
Wiki Guide to contributing to the wikiWikicodeAutowiki