Template:Row numbers: Difference between revisions
en>Trappist the monk No edit summary |
en>Trappist the monk No edit summary |
||
Line 1: | Line 1: | ||
<includeonly>{{#invoke: | <includeonly>{{#invoke:row counter|row_counter|{{{1}}}}}</includeonly><noinclude> | ||
{{documentation}}</noinclude> | {{documentation}}</noinclude> |
Revision as of 12:09, 12 April 2018
This template uses Lua: |
This is a stop-gap template that serves as an interface to Module:Row numbers.
This template makes it possible, in many cases, to have an incrementing row indexer/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 automatically adding row numbers via WikiTable syntax. See Phab: T42618 - "jquery.tablesorter: Add support for a 'fixed' column of row numbers." And see Help:Sorting, and the sections on row numbering and auto-ranking. Using Template:Row numbers is one of the methods described on that page.
Usage
TemplateData for Row numbers
This template takes an arbitrary number of parameters: the table and the starting index. There is a caveat: the table is wrapped in the template without escaping the |
characters. The module is capable of dealing with this, but it is not capable of dealing with bare equals signs at the same time. As such, bare equals signs must still be escaped with {{[[Template:{{{1}}}|{{{1}}}]]}}. Internally, the Module maintains a monotonically increasing counter. The Module looks for the keywords _row_count
and _row_count_hold
in the table. Keyword _row_count
is replaced with the next counter value; keyword _row_count_hold
is replaced with the value from the last _row_count
replacement.
Visual effect | Markup |
---|---|
Script error: No such module "row counter".} | {{row numbers| {| class{{=}}"wikitable" |+test incrementor !count !! lorem |- |_row_count || {{Str left|{{Lorem ipsum span}}|123}} |- |_row_count || {{Str left|{{Lorem ipsum span}}|27}} |- |_row_count || {{Str left|{{Lorem ipsum span}}|5}} |- |_row_count_hold || {{Str left|{{Lorem ipsum span}}|11}} |- |_row_count || {{Str left|{{Lorem ipsum span}}|123}} |}}} |
Script error: No such module "row counter". | {{row numbers| {| class{{=}}"wikitable" |+test incrementor !count !! lorem |- |_row_count || {{Str left|{{Lorem ipsum span}}|123}} |- |_row_count || {{Str left|{{Lorem ipsum span}}|27}} |- |_row_count || {{Str left|{{Lorem ipsum span}}|5}} |- |_row_count_hold || {{Str left|{{Lorem ipsum span}}|11}} |- |_row_count || {{Str left|{{Lorem ipsum span}}|123}} |} |index =50}} |