Anonymous user
Generating tabular output (examples): Difference between revisions
Generating tabular output (examples) (view source)
Revision as of 08:23, 23 April 2022
, 2 years agono edit summary
imported>FrozenPlum m (Fix title level) |
imported>FrozenPlum No edit summary |
||
Line 9:
=== Single template value===
'''Example:'''<br><br><!-- transclude example from subpage-->{{#lsth:Controlling output format/Parameter:_tablerow_(example 1)|Example}}
{{example|tablerow|eg=1}}
'''Result:'''<br><!-- transclude result from subpage-->{{#lsth:Controlling output format/Parameter:_tablerow_(example 1)|Result}}
'''Note:''' The <code>%%</code> in <code>tablerow</code> allows precise positioning of the column value, inside whatever formatting you want to apply.▼
▲'''Note:''' The <code>%%</code> in <code>tablerow</code> allows precise positioning of the column value, inside whatever formatting you want to apply.
<!-- The <code>{{DPL|tablerow}}</code> statement is best explained by an example:
<pre>
category=Help
titlematch=DPL%
count=4
includepage ={DPL Manual}:section,%-1[25]
|tablerow = style="background:#eeffee;"¦%%▼
table =,Title,Sub Title,Last Section (25 chars)
</dpl>
</pre>
<dpl>
category=Help
titlematch=DPL%
count=4
includepage ={DPL Manual}:section,%-1[25]
table =,Title,Sub Title,Last Section (25 chars)
</dpl>
The following example includes the use of {{DPL|addpagecounter}} and {{tt|%COUNT%}}, both of which were removed in MediaWiki 1.25.
<pre>
category=African Union member states
nottitlematch=Sudan
addpagecounter=true
includepage ={Infobox Country or territory}:area:population_estimate,%0[100]
▲|tablerow = style="background:#eeffee;"¦%%
format =,,\n|style="text-align:right;"|²{#ifexpr:%COUNT%>300¦<big>'''%COUNT%'''</big>¦%COUNT%}²,
table =,Country,Area,Population,Text,#hits
tablerow =style="text-align:right;"|%%,style="text-align:right;"|%%,style="background-color:lightyellow;"|<small>%%</small>,\n|style="text-align:right;"|%%
</dpl>
</pre>
* We select some African countries, we exclude Sudan
* We acquire a piece of meta data about the articles we will find (in our case the usage counter)
* We include two named parameters from a template call, <nowiki>{{Infobox Country or territory}}</nowiki>
* We include a short text passage from the text before the first chapter
* We use the third parameter of <code>{{DPL|format}}</code> to output the usage counter (we could even highlight values above 100 here, for example)
* We highlight usage values above 300
* We define a standard wiki table with the article name in the first column (named "Country")
* We define column headers for transcluded contents and for the usage counter
* We care for right alignment of the numerical values and define a background-color for the text -->
|