From Dark and Darker Wiki

m (wiki editing guide - added how to update TODO page)
No edit summary
 
(28 intermediate revisions by 3 users not shown)
Line 1: Line 1:
I recommend using "Edit Source" as Visual Edit doesn't work well.
<h1>Video Introduction to Wiki Editing</h1>
=Edits=
{{#ev:youtube|https://www.youtube.com/watch?v=yt-k2EW1r5A}}
When making an edit with the intention of bring it up to date with a hotfix/patch release, specify that the page is up to date and change the status color from red/orange to green in [[TODO]].  


=Extensions=
Tabber extension allows content to be created under tabs. Unfortunately, doesn't support visual edit
<pre><tabber>
|-|Content1=
Here is your content 1
|-|Spells=
Spells here etc.
</tabber></pre>
becomes:
<tabber>
<tabber>
|-|Content1=
|-|MediaWiki Guide=
Here is your content 1
{{:MediaWiki Guide}}
|-|Spells=
Spells here etc.
</tabber>


=Templates=
|-|Template Hierarchy=
The data for items are pulled from templates:
{{:Template Hierarchy}}
*[[Template:Weapon_Data]]
*[[Template:Armor_Data]]
*[[Template:Item_Data]]
*[[Template:Crafting_Data]]


also planning to add monster data and jewelery data. Also could combine every item on Item Data, that might not be good for load times tho.
|-|Special Pages=
This tab highlights some useful special pages.


Infobox Templates:
[[Special:SpecialPages]]
*[[Template:Infobox]]
*List of all special pages. Everything below can be found here.
**Used for pretty much all items/monsters
*[[Template:Infobox_Class]]
**Used only for classes atm, will merge it into Infobox in future


==Weapon Templates==
[[Special:WantedPages]]
*[[Template:Weapons]]
*List of all pages that are linked to but do not exist.
**Menu of weapons


*[[Template:Weapon Data]]
[[Special:WantedTemplates]]
*List of all templates that are linked to but do not exist.


Templates for Individual Weapon pages:
[[Special:WantedFiles]]
*[[Template:GenerateWeaponRow]]
*List of all files that are linked to but do not exist.
*[[Template:GenerateHitbox]]
*[[Template:GenerateWeaponCombo]]
*[[Template:GenerateBlock]]
*[[Template:GenerateUnique]]
*[[Template:ActionMoveSlow]]
*[[Template:AutoGenerateWeaponTabs]]
**calls [[Template:GenerateWeaponTabs]] with <pre>{{PAGENAME}}</pre>


Templates for class pages:
[[Special:WhatLinksHere]]
*[[Template:ListWeaponsForClass]]
*Lists all pages that link to searched item.
*Can be used to see where certain templates are used.<br>For example, searching "Template:AutoGenerateWeaponTabs" will give the list of all the individual weapon pages, plus a few more.


[[Special:BatchUpload]]
*Used to upload multiple files at once.


Info Templates:
[[https://darkanddarker.wiki.spellsandguns.com/Special:AllComments]]
*[[Template:Sword]]
*Repository of all comments, in  order of youngest to oldest.
*[[Template:Maces]]
</tabber>
*[[Template:Daggers]]
*[[Template:Polearms]]
*[[Template:Axes]]
*[[Template:Bows]]
*[[Template:Crossbows]]
*[[Template:Magical Weapons]]
*[[Template:Musical Instrument]]
*[[Template:Shields]]
 
==Armor Templates==
*[[Template:ArmorTable]]
*[[Template:GenerateArmorRows]]
 
Info Templates:
*[[Template:Head Armor]]
*[[Template:Chest Armor]]
*[[Template:Legs Armor]]
*[[Template:Hands Armor]]
*[[Template:Foot Armor]]
*[[Template:Back Armor]]
 
==Craft Templates==
*[[Template:Crafting_Data]]
**Database
*[[Template:GenerateCraftingRow]]
**Single crafting recipe row
*[[Template:GenerateCraftingRows]]
**Generate multiply, according to ingredient or trader etc.
*[[Template:Ingredient]]
**Used on individual page like [[Bone]], Gives info on ingredient, shows all recipes that uses it
*[[Template:Craftable]]
**Used on individual page like [[Cobalt Hat]], Shows its crafting recipe
 
==Drops Templates==
*[[Template:GenerateLootDrops]]
**Generates loot drops and tables of a given creature
*[[Template:GenerateDropTables]]
**Generates list of creatures that a given item is dropped by
 
==Utility Templates==
*[[Redirect]]
**Not a template - upon entering source page user is redirected to another page
*[[Template:Transclude]]
**Pastes all content from a section of a given page
*[[TODO]]
**Not a template - shows last patch a page was manually entered as up-to-date for
 
 
[[Special:BatchUpload]]

Latest revision as of 07:38, 23 June 2024

Video Introduction to Wiki Editing

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.

Color Legend:
Template Calls

Transclusion Calls Links to non-template and non-transcluded pages, or plain text.

The text of the hierarchy nodes links to the template page itself.

For Template nodes, the leading arrow links to the template edit page.


The main pages use the following template and transclusion structures:

Temporarily disabling this page as it is out of date.


This tab highlights some useful special pages.

Special:SpecialPages

  • List of all special pages. Everything below can be found here.

Special:WantedPages

  • List of all pages that are linked to but do not exist.

Special:WantedTemplates

  • List of all templates that are linked to but do not exist.

Special:WantedFiles

  • List of all files that are linked to but do not exist.

Special:WhatLinksHere

  • Lists all pages that link to searched item.
  • Can be used to see where certain templates are used.
    For example, searching "Template:AutoGenerateWeaponTabs" will give the list of all the individual weapon pages, plus a few more.

Special:BatchUpload

  • Used to upload multiple files at once.

[[1]]

  • Repository of all comments, in order of youngest to oldest.