From Dark and Darker Wiki

Basics

There are two ways to edit a page:

Edit aka, "Visual Edit".

  • If you want to make a simple change -to fix a typo, let's say- then edit is the better and faster option.
  • This mode makes creating and editing tables quicker than in source edit.
    Pasting a copy selection from Excel/G-Sheets to the wiki is as simple as pasting regular text.
    • Note: editing colors and other niche properties will require using Source Edit.
  • Visual Edit isn't accessible on Template pages.

Source Edit

  • Takes you to a codebox that highlights wikitext syntax.
  • "Show preview" allows you to edit code and see the effects of your edits before committing the changes with "Save changes".
  • If you enter an empty page, i.e. an existing page without content, try using Source Edit.
    More likely than not, there is code that is hidden within <includeonly> html tags.


TODO: Add info that the general user may be interestd in. Stuff like basic markup.
Join the Wiki Discord if you wish to discuss changes, ideas, or questions.

MediaWiki

The Dark and Darker wiki runs on MediaWiki software.

This gives the wiki access to a few basic features like magic words, basic text markup, and HTML markup.
Mediawiki also allows the inclusion of several extensions that emulate more traditional programming language elements.

The sections below will touch upon most but not all of the commonly used elements on the Wiki.
For more comprehensive information and guides it is best to follow the included hyperlinks.

TODO: Add section on basic template/transclusion usage. I.e. stuff like parameters. Maybe comment on intuition for using certain things?

TODO: Add section on MediaWiki whitespace handling. Differences between basic MediaWiki and ParserFunction whitespace handling.

Built-In Features

Text Markup

Great for basic text formatting.

Generally not used in Template code, where text formatting requires more complex functionality like CSS and Parser Funtions.

HTML Markup

<!--...-->

  • HTML comments are commonly used to emulate the whitespace structures of more traditional languages like Python, Java, and C.

<span>...</span>

  • This tag is used to apply CSS to a specific section of text. Think "inline" CSS.

<div>...</div>

  • This tag is used to apply CSS to a "block", text or otherwise. Think "page element" CSS.

Magic Words

{{PAGENAME}} returns the name of the page.

  • Commonly used in Auto-templates to call templates with the name of the page.

{{lc: "string"}} returns "string" in lowercase.

  • Primarily used as data validation to default strings to lowercase.

Extensions

ParserFunctions

{{#switch: "value" | case1 = result1 | case2 = result2 | ... | #default = resultN }} returns the result corresponding to the first case that matches value, or default if none match.

  • The wiki's primary way of storing data. Used to create data templates.

{{#if: not "null" | value_if_true | value_if_false }} returns values depending on whether the if clause has a non empty string or not.

  • OR logic: include multiple variables in the if clause to check if any of them are not "null".
    • {{#if: (not "null")(not "null")(not "null") | value_if_true | value_if_false }}
      • If any of the variables are not "null", return value_if_true, otherwise return value_if_false.
  • AND logic: use multiple, nested if statements to check if all of the variables are not "null".
    • {{#if: not "null" | {{#if: not "null" | value_if_true | value_if_false }} | value_if_false }}
      • If Clause1 and Clause2 are not "null", return value_if_true, otherwise return value_if_false.
    • The AND logic is less resource efficient than the OR logic, but it is often necessary.
    • #if is commonly used with "#switch" to do data validation.
      E.g. if a value is not "null", continue doing further work on the data .
  • Common formats:
    • Inline:
      • {{#if: condition | value_if_true | value_if_false }}
    • Block:
      • {{#if: condition<!--
        -->| value_if_true<!--
        -->| value_if_false }}
      • Note that the pipe characters begin the lines rather than end the lines.
        When the "then clause" or the "else clause" have multiple lines, the code is easier to follow as you can identify where each clause begins at aglance.
        This in addition to indentation scope makes it easy to parse the code visually.
      • The block format is used to emulate the whitespace structures of more traditional languages like Python, Java, and C.
        Unless the condition is very simple, the block format is preferred as it is easier to read and edit.

{{#ifeq: value1 | value2 | value_if_equal | value_if_not_equal }} returns value_if_equal if value1 is equal to value2, and value_if_not_equal otherwise.

ParserFunctions/Strings

{{#pos: string | substring }} returns the position of the first occurrence of substring in string, or "null" if substring is not found.

  • Used to like an "or" statement.
    If the substring is found, the return value is not "null".

{{#replace: string | substring | replacement }} returns string with all occurrences of substring replaced by replacement.

  • Typically used to replace commas with other separators.

{{#explode: string | delimiter | index | limit }} returns the index-th element of the list obtained by splitting string at each occurrence of delimiter.

  • "limit" is optional.
    If you only need the first few elements, "limit" is used to save resources.
  • If index is negative, the explode redturns in reverse index order.
  • Explode is commonly used to split a string along some character(s), making it efficient to retrieve sections of a list-type string.
    • Can be used to strip portions of a string.

Variables

{{#vardefineecho: variable_name | value }} returns value and defines variable_name as value.

  • This is useful when handling data that is used more than once.
    Calls to data templates eat up resources, so it is best practice to store the data in a variable and call the variable instead of the data template.
    This is true even if the template data is only called twice.
  • Typically used within the "flow" of code, i.e.
    within a #if or #switch statement.

{{#vardefine: variable_name | value }} returns nothing and defines variable_name as value.

  • Slightly less efficient than vardefineecho, but useful when you need to use a var in various scopes.

{{#var: variable_name }} returns the value of variable_name.

  • Commonly used within a few lines of the vardefineecho.
  • Unlike in traditional programming languages the return value is not "typed".
    It is a string.
  • A common bug is to write the variable name but forget to include the curly braces and var tag.
    So instead of referencing a variable's value you simply have a static string.
    This sometimes goes unnoticed when using #var: with #if:.

Arrays

{{#arraydefine: variable_name | value1, value2, ... }} returns nothing and defines variable_name as an array.

  • Commonly used to transform a comma separated list into an array.
  • Occasionally used to transform comma separated lists into slash (or other) separated lists.

{{#arraysize: variable_name }} returns the number of elements in variable_name.

  • Commonly used to set how many iterations of a loop to execute.

{{#arrayindex: variable_name | index }} returns the index-th element of variable_name.

  • Almost always used with #loop to do work on individual elements in an list/array.

Loops

{{#loop: start | end | step | code }} returns the result of code executed for each value in the range start to end, incrementing by step.

Tabber

This extension allows content to be created under tabs.

The entire Wiki Editing page is organized using this extension.