Template:Example/end

From Noita Wiki
Jump to navigation Jump to search


This is a template for creating formatted Example boxes, e.g. for example wand builds. The examples are automatically numbered, can be given anchor permalinks and can be included in other pages using Labeled Section Transclusion.

Example box:

Results box:


Usage

Create

{{example/start|anchor=anchor_id|title=Some title|heading=2|toc=0}}

Example contents, text, templates etc.

{{example/result/start}}
A result of some calculation or markup.
{{example/result/end}}

{{example/end}}

Linking

On page "SomeArticle", with {{example/start|anchor=Foo}}

  • [[#Foo]] - link within the page
  • [[SomeArticle#Foo]] - link from elsewhere
  • [[SomeArticle#Foo | Foo Example]] - custom link text

Transclusion

Each example comes wrapped in a <section>, allowing it to be transcluded into other pages. The section label is the same as the anchor.

Parameters

  • All parameters are optional, defaults used if they are omitted
Parameter Default Description
anchor Sequential Must be unique on the page. If specified, will be used as a second, named anchor to the Example, which can be used to link to it. This is in addition to the auto-generated, sequential anchor.

Note: Sequentially generated anchors will change based on the order and number of examples on the page.

If no anchor is set, and a title is, the latter will be used to create a named anchor instead.

title Example N: Add a title to the example, which will be inserted following the 'Example N:' default text. This title is also used when listing the example in the page's table of contents.

If no anchor is specified the title will be used to generate a named anchor & section name.

heading 0 Sets the base heading level for this example - the nesting depth is added to this base to give the actual heading level.

4 is equivalent to an <h4> tag, or ==== heading ====

Set to 0 for no heading (this also excludes the example from the TOC).

toc 1 Sets the maximum nesting level for examples to be included in the page table of contents (TOC). Defaults to 1, which means that this example will be included if it is not nested. Set to 0 to exclude the example from the TOC. Set to 2 or higher to include nested Examples.

Notes:

  • Nested examples will be numbered within their nesting section (like: 1.1, 1.2 etc.)
  • While an arbitrary level of nesting will work, I can't really see much use for it with this template.

Usage examples

Example 1:
Basic use

Note how the title is used to create the anchor and transclusion links, in absence of the anchor parameter.

{{example/start|title=Teleport Wand}}
This is an example of a teleport wand.
{{Wand
| capacity    = 7
| spell1      = Double Spell
| spell2      = Reduce Lifetime
| spell3      = Long-Distance Cast
| spell4      = Add Mana
| spell5      = Nolla
| spell6      = Small Teleport Bolt
| spell7      = Chainsaw
}}
{{example/end}}
Result:
Example 1:
Teleport Wand

This is an example of a teleport wand.

Wand 0821.png
Shuffle
No
Spells/Cast
1
Double Spell
Reduce Lifetime
Long-Distance Cast
Add Mana
Nolla
Small Teleport Bolt
Chainsaw


Example 2:
Anchor parameter

Note that the anchor link comes from the anchor param, not the title.

{{example/start|title=My Title|anchor=Some Anchor}}
You can embed a Wand build directly into a wiki page using {{tl|Wand}}
{{example/result/start}}
{{Wand}}
{{example/result/end}}
{{example/end}}
Result:
Example 1:
My Title

You can embed a Wand build directly into a wiki page using {{Wand}}

Result:
Wand 0821.png
Shuffle
No
Spells/Cast
1


Example 3:

Headings

This example has a heading level of 1, which equates to h2 level without nesting.

Example 4:

Headings

This example has a heading level of 2, which equates to h2 level without nesting.

Example 4.1:
Headings

This nested example has a heading level of 2, which equates to h3 level.

Example 4.1.1:
Headings

This nested example has a heading level of 2, which equates to h4 level.

Example 5:

Headings

This example has a heading level of 3, which equates to h3 level without nesting.

Example 6:
Headings

This example has a heading level of 4, which equates to h4 level without nesting.

Example 7:
Headings

This example has a heading level of 5, which equates to h5 level without nesting.

Example 8:
Headings

This example has a heading level of 6, which equates to h6 level without nesting.

Example 9:
Nesting & TOC

Non-nested examples, by default, create section links/entries in the TOC. Disable this with toc=0.

{{example/start|anchor=egA}}
This example is more deeply nested. By default it is omitted from the TOC.
{{example/end}}
{{example/start|anchor=egA|toc=2}}
This example is included, thanks to <code>toc=2</code>.
{{example/end}}
{{example/start|anchor=egAA}}
This example is more deeply nested.
{{example/start|anchor=egAAA|toc=4}}
This example is more deeply nested.
{{example/start|anchor=egAAA}}
This example is probably too deeply nested.
{{example/end}}
{{example/end}}
{{example/end}}
{{example/end}}
{{example/start|anchor=egB|toc=0}}
This example is at the top level, but not included in the TOC.
{{example/end}}
Result:
Example 1:

This example is more deeply nested. By default it is omitted from the TOC.

Example 2:

This example is included, thanks to toc=2.

Example 3:

This example is more deeply nested.

Example 3.1:

This example is more deeply nested.

Example 3.1.1:

This example is probably too deeply nested.

Example 1:

This example is at the top level, but not included in the TOC.