Jump to content

Template:Row numbers/doc

From escforumwiki
Revision as of 12:43, 12 April 2018 by en>Trappist the monk (Usage: mw.text.decode() to aggressive;)

This is a stop-gap template that serves as an interface to Module:Row counter.

This template makes it possible, in many cases, to have an incrementing row counter in a table so that adding or removing rows automatically adjusts the numbering of subsequent rows. This template will become obsolete if and when MediaWiki supports automatic row counters in WikiTable syntax.

Usage

This template takes one parameter: the table. There is a caveat: the table must be wrapped inside <nowiki>...</nowiki> tags so that all of the pipe characters (|) required in a wiki table do not confuse the template into thinking that they are all individual template parameters. Internally, the Module maintains a monotonically increasing counter. The Module looks for the keyword _row_count in the table and replaces the keyword with the next value from the counter.

{{row counter|
<nowiki>{| class="wikitable"
|+test incrementor
!count !! lorem
|-
|_row_count || {{Str left|{{Lorem ipsum}}|123}}
|-
|_row_count || {{Str left|{{Lorem ipsum}}|27}}
|-
|_row_count || {{Str left|{{Lorem ipsum}}|5}}
|-
|_row_count || {{Str left|{{Lorem ipsum}}|11}}
|-
|_row_count || {{Str left|{{Lorem ipsum}}|123}}
|}</nowiki>}}

Template:Row counter There are further caveats. When wrapped in <nowiki>...</nowiki>, the '<' and '>' characters that begin and end all html-like markup, are replaced with &lt; and &gt; html entities respectively. Because the Module cannot know if there are html entities already in use before the table was wrapped in the <nowiki>...</nowiki> tags required here, when the module replaces the html entities with '<' and '>' characters, something may break. caveat lector.

MediaWiki spam blocked by CleanTalk.