WikiFormatting

From WildStar NASA Reference Wiki
Jump to: navigation, search


Best practices in formatting content for the wiki.

Official MediaWiki Formatting Documentation

The official Media Wiki documentation is a good place to start when trying to figure out how to format something:

You can also look at the edit pane on a particular wiki page to figure out how someone managed to get the style you're looking for.

Code Samples

Code samples will likely be apart of most pages on the wiki, so the Media Wiki extension SyntaxHighlight GeSHi extension has been added to allow for syntax highlighting on individual wiki pages.

To mark up the syntax of some code (typically in the case of a WildStar addon, in Lua), you would use the syntaxhighlight tag with the lang argument set to lua:

  <syntaxhighlight lang="lua"></syntaxhighlight>

So if you wanted to write a couple of statements as an example to demonstrate, you could right the following:

<syntaxhighlight lang="lua">
local tParamaters= {
  iWindowType = GameLib.CodeEnumStoryPanel.FullScreen,
  tLines = {"Test", "Test 2"},
  nDisplayLength = 5,
}
</syntaxhighlight>

You would end up with the following:

local tParamaters= {
  iWindowType = GameLib.CodeEnumStoryPanel.FullScreen,
  tLines = {"Test", "Test 2"},
  nDisplayLength = 5,
}


To get the traditional box and word wrapping to keep the lines from going out of the window, use the following as your opening tag.

<syntaxhighlight lang="lua" enclose="div" style="padding: 1em; margin: 1em 0; border: 1px dashed #2f6fab; background-color: #f9f9f9; font-size: medium;">

This will give you something similar to this:

local tParamaters= {
  iWindowType = GameLib.CodeEnumStoryPanel.FullScreen,
  tLines = {"Test", "Test 2"},
  nDisplayLength = 5,
}

There are number of options you can add to enhance the marked up syntax and you can find more details in the usage section of the Syntax Highlight GeSHi page on the media wiki site.

API Function Definitions

Required Elements

The following elements are required when writing an API definition:

Category

You need to specify which Category on the wiki this is associated with. This helps make navigation clear and allows the wiki to automatically add a reference on the Category page.

The Category text is typically the name of the package the function is contained within.

An example would look like this:

[[Category:AbilityBook]]

Description

It should be obvious, but you need to provide at least a summary of what a function does.

An example would look like this:

== Description ==
Get the number of Action Sets you have unlocked.

Arguments

Outline a list of arguments that provide three things:

  • The Name of the Argument - Mostly for discussion.
  • The Type
  • Any further discussion about what the function might expect of the argument.

An example would look like this:

== Arguments ==

 * mouseDown - Boolean - Description.

Returns

Describe the return value by specifying:

  • The Type
  • A Description (if necessary).

An example would look like this:


== Returns ==
Number - The numeric value returned will always be positive. 


Example Usage

Write a short snippet of code to demonstrate how the function is used. Make sure to wrap it in a pair of ""Code"" tags and indent the example code with a minimum of 2 spaces for clarity when editing.

Also describe the expected output from the example provided and document it as if you were getting it off of the lua console.

An example would look like this:

=== Example Usage ===

Print the value of what the current spec is.

<syntaxhighlight lang="lua">
  Print(AbilityBook.GetCurrentSpec())
</syntaxhighlight>

Should return the following output:

<syntaxhighlight lang="lua">
  Debug: 2
</syntaxhighlight>

If you need to provide multiple examples, just repeat the format above.

Example

Here's an example of what the wiki page would look like when you're editing it.

  [[Category:AbilityBook]]

  == Description ==
  Get the number of Action Sets you have unlocked.

  == Arguments ==
  None

  == Returns ==
  number - Returns the single number representation of the number of action sets you currently have unlocked.

  == Example Usage ==
  If you just reached level 20 and unlocked your 2nd Action Set.

  <syntaxhighlight lang="lua">
    Print(AbilityBook.GetNumUnlockedSpecs())
  </syntaxhighlight>

  Will return you the following result:

  <syntaxhighlight lang="lua">
    Debug: 2
  </syntaxhighlight>

Template

A template you can copy and paste into your new api function page to get you started in filling in the details. You want to replace everything wrapped with the <-- -->.


[[Category:<-- Package Name -->]]

== Description ==
<-- Write a description for what the function does.  Be as detailed as possible. -->

== Arguments ==
<-- Provide a breakdown of each of the arguments, in the order they're used. -->

 * <-- Argument Name --> - <-- Type --> - <-- Description If Necessary -->

== Returns ==
<-- Type --> - <-- Description If Necessary -->

== Example Usage ==
<-- Describe the example your providing -->

<syntaxhighlight lang="lua">
    <-- One or more series of statements. -->
    <-- That demonstrate how to use the function. -->
</syntaxhighlight>

<-- Expect result you would see on the console. -->

<syntaxhighlight lang="lua">
    <-- Console output -->
</syntaxhighlight>