Examples/Parameter: format (example 2): Difference between revisions
< Examples
Content added Content deleted
imported>FrozenPlum mNo edit summary |
imported>FrozenPlum m (FrozenPlum moved page Controlling output format/Parameter: format (example 2) to Examples/Parameter: format (example 2): Simplifying how things are structured) |
||
(One intermediate revision by the same user not shown) | |||
Line 6: | Line 6: | ||
==Example== |
==Example== |
||
The following is an example of how to use the |
The following is an example of how to use the variable <code>{{DPL|%NR%}}</code> to set the font size. This will list articles in [[:Category:Fruit examples]], by title (in descending order), limited to a count of four. Each result will be formatted to appear on a new line and the font size will be set using a [[mw:Help:Extension:ParserFunctions##expr|parser function (math) expression]], to calculate the current article sequence number (starting from 1) times 0.5em, which will increase the font size each subsequent article. |
||
<pre> |
<pre> |
||
{{#dpl: |
{{#dpl: |
||
|category |
|category = Fruit examples |
||
|count |
|count = 3 |
||
|ordermethod |
|ordermethod = title |
||
|order |
|order = descending |
||
|format |
|format = ,\n<span style="font-size: ²{#expr:%NR% * 0.5}²em;">'''[[%PAGE%]]'''</span>,\n, |
||
}}</pre> |
}}</pre> |
||
==Result== |
==Result== |
||
{{#dpl: |
{{#dpl: |
||
|category |
|category = Fruit examples |
||
|count |
|count = 3 |
||
|ordermethod |
|ordermethod = title |
||
|order |
|order = descending |
||
|format |
|format = ,\n<span style="font-size: ²{#expr:%NR% * 0.5}²em;">'''[[%PAGE%]]'''</span>,\n, |
||
}} |
}} |
||
<noinclude> |
<noinclude> |
Latest revision as of 23:52, 31 March 2023
Example
The following is an example of how to use the variable %NR%
to set the font size. This will list articles in Category:Fruit examples, by title (in descending order), limited to a count of four. Each result will be formatted to appear on a new line and the font size will be set using a parser function (math) expression, to calculate the current article sequence number (starting from 1) times 0.5em, which will increase the font size each subsequent article.
{{#dpl: |category = Fruit examples |count = 3 |ordermethod = title |order = descending |format = ,\n<span style="font-size: ²{#expr:%NR% * 0.5}²em;">'''[[%PAGE%]]'''</span>,\n, }}
Result
{{#dpl: |category = Fruit examples |count = 3 |ordermethod = title |order = descending |format = ,\n%PAGE%,\n, }}