Changes

Jump to navigation Jump to search

Wurmpedia editing handbook

160 bytes added, 20:20, 15 September 2020
m
Saving changes, still a WIP. Feel free to make edits above Tables.
'''Fun Fact''': You can create a clickable link to get to that category page by adding a colon to the beginning. To link to the Blacksmithing items category, you would add <nowiki>[[:Category:Blacksmithing items]]</nowiki>.
 
==Babel categories==
[[File:Handbook21.png|border|]]
 
==Babel categories==
'''Every article''' on the main namespace should be linked to a letter in the Babel alphabetical index. This is a series of category pages that show articles beginning with that number or letter. To link to a Babel category, simply add <nowiki>[[Category:Babel/F]]</nowiki>, where F is the letter or number you wish to add it to.
Great! But on this page, we want it to say "This is a purple unicorn." Since we have "color" in curly brackets, we can specify this option. To do this, you will add a new line to your template link, like so:
<nowiki>{{Unicorn|color=purple}}</nowiki>
Now on clicking show preview, you will see:
Any content written directly into the template will show on both the template’s page as well as any pages using the template.
 
Any content you want to show only on pages using this template and not the template itself should be within <nowiki><includeonly></nowiki> and <nowiki></includeonly></nowiki>. This will make your code invisible on the Template page, and only visible when the template is used.
<nowikipre><includeonly>
This is a {{{color}}} unicorn.
</includeonly>
</pre> To put information ''only'' on the Template:Unicorn page, it will need to be within <nowiki><noinclude></nowiki> and <nowiki></noinclude></nowiki>tags. This will prevent anything written in these tags from being shown on pages the template is used on. This is used to display information about your template.
To put information only on the Template:Unicorn page, it will need to be within <noincludepre> and </noinclude> tags. This will prevent anything written in these tags from being shown on pages the template is used on. This is used to display information about your template.<includeonly>
This is a {{{color}}} unicorn.
</includeonly>
This template is used on Unicorn pages and displays important text that will show you what colour the unicorn is.
</noinclude>
</pre>
 
Result:
 
[[File:Handbook23.png|border|]]
It is also important to put instructions on how to use the template in the noinclude tag as well. Templates put this information within <pre> and </pre> tags, which shows the contained information in a light grey-coloured box. It also allows you to display code, which is great for giving a sample of the template for users to copy and paste so they may use it.
<includeonly>
This is a {{{color}}} unicorn.
</includeonly>
It is also important to put instructions on how to use the template in the noinclude tag as well. Templates put this information within <nowiki><noincludepre></nowiki> and <nowiki></pre></nowiki>tags, which shows the contained information in a light grey-coloured box. It also allows you to display code, which is great for giving a sample of the template for users to copy and paste so they may use it. [[File:Handbook25.png|border|]]
This template is used on Unicorn pages and displays important text that will show you what colour the unicorn is[[File:Handbook24.png|border|]]
<pre>{{Unicorn|color=}}</pre></noinclude></nowiki>=“If” Statements==
“If” Statements
===What is an if statement ?!===
What is an if statement ?!
For those who are not familiar with coding, an if statement is something that is used to do a certain thing if the statement is true, and something else if it is false. For example:
<pre>
If 1+1=2: Say yes
If 1+1=3: Say no
</pre>
If this was your code, it would result in Say yes.
===How do I make an if statement?===
In templates, we sometimes want to add an if statement so that we can make the template work in many different articles. For example, in the Fence template, here is a sample of an if statement:
<pre>{{#if:{{{gate|}}}|[[Iron fence gate]]|[[Iron fence]]}}</pre>
Let's break this down and see what is going on here!
First, your if statement needs to be inside 2 curly brackets: <nowiki>{{ and }}</nowiki>.
If statements are started by typing #if:
If statements will have a true and a false side to them, respectively. To separate what will happen in each case, you use vertical bars |.
<pre>
{{#if:<what you're checking>|<what happens if it's true>|<what happens if it's false>}}
</pre>
The thing you want to check with your if statement will go after the colon. In this case, we are checking the argument called "gate". Arguments are used in 3 curly brackets {{{ and }}}. If you want to look for something specific, you will need to use a different kind of if statement, #ifeq: which we will discuss shortly. In this case, the statement is checking for whether the argument "gate" is defined with anything at all, so there is nothing to the right of the bar.
 
<pre>
{{#if: {{{gate|}}} |<what happens if it's true>|<what happens if it's false>}}
</pre> 
For the true/false sections, you can place text that will be displayed if the if statement reaches that section. In this example, if it is true the page will display [[Iron fence gate]], which is a link to the Iron fence gate article.
 '''Tip: ''' You can place if statements within if statements for more complex scenarios. For example, maybe you want an if statement that does something like this: [picture of if tree i I guess] 
But let's not get ahead of ourselves. Getting started with if statements is enough on your plate!
 ===If a variable = something specific:=== The next if statement we should talk about is the '''#ifeq ''' statement. This is used when you want to ask if something matches something else. In our case, we will just about always use it to ask if an inputted variable is something specific. For example, you may have "material" as a variable in your template, where a user would put what material it is made of. Let's say you want the page to display that a pottery bowl is used in cooking if the material given is "clay", and otherwise display "Cannot be used in cooking."  <nowiki>{{#ifeq:{{{material}}}|clay|A pottery bowl is used in cooking.|Cannot be used in cooking.}}</nowiki> 
This statement will give either one or the other, depending on what material is given. Notice that the variable named "material" is enclosed in three curly brackets, and then has three sections divided by vertical bars after it, whereas the #if statement we looked at a moment ago only had two sections. This format adds a section after the variable where you can tell the statement what you are checking the variable for. After that, the last two sections are the same: what to display if it is true, then what to display if it is false.
 ===Switches - The Multi-Scenario “if” Statement=== A '''switch ''' is a type of if statement in which you can define multiple things that may be contained within an argument, and what will happen in each case. 
You may wish to use a switch when you want to display a different line of text depending on what is entered.
 
For example, your argument may be "server", with options being Xanadu, Pristine, Exodus, Celebration, Deliverance, Chaos, Release, and you may wish to provide a different map link depending on which server is inputted. Here is what it would look like:
 <nowiki>{{#switch: {{{server}}}
|Xanadu = link to Xanadu map
|Pristine = link to Pristine map
...
}}</nowiki> Like with if statements, you need to have '''#switch''': contained within curly brackets. Right after that, indicate your argument name within 3 curly brackets. Next, you will have a vertical bar followed by the text you want to match in that argument. Follow that with an equal sign, and then the text you want to display on the page if that instance is true. '''NOTE: ''' Your display text cannot contain any vertical bars in a '''switch ''' because the switch searches for the bar to look for the next case you are asking for. Vertical bars will most commonly be found in a table, which begins with <nowiki>{|</nowiki>. You can either put the information in another template and call that template to be inserted, or use HTML code instead. ===Tables=== 
The MediaWiki Wiki says that it is best to avoid table making unless needed due to the complication of table code... but I say tables make some wiki pages so much prettier to look at, and can make information easier to present. Maybe just try to get it right the first time so you don't have to edit it later! Or, if you're brave enough, maybe you can come up with a template to make tables easier!
 
Table Construction Markup
Let's start with the markup. The following table is taken from mediawiki.org.
editor
7,290

edits

Navigation menu