Examples/Parameter: multisecseparators (example 3): Difference between revisions
imported>FrozenPlum m (Changed my mind, this note in the surrogate should be enough.) |
imported>FrozenPlum m (tweak link text) |
||
(5 intermediate revisions by the same user not shown) | |||
Line 6: | Line 6: | ||
==Example== |
==Example== |
||
This example |
This example uses a [[Template:DPL parameter.surrogateexample|surrogate (also known as phantom) template]] to format the second and third column of results. The first column is included in the <code>{{DPL|listseparators}}</code> statement, to prevent the page name from being repeated in every subsequent line. The second and third column, formatted in the surrogate, creates a link to the page's parameter name section, and then display the "purpose" text using [[mw:Help:Extension:ParserFunctions|Parser Functions]]. This combination of formatting the page name in a "separators" format statement '''and''' a surrogate template, results in templates used multiple times on a page to be separated into separate table rows under the parent page name (normally repeat templates used on a page are combined into a single row). This example is advanced, for more, simple examples of surrogate template use see [[Controlling output volume#include contents related to templates|include examples]] as related to including contents from templates, see the <code>{{DPL|table}}</code> and <code>{{DPL|tablerow}}</code> parameters for straightforward table examples. |
||
<pre> |
<pre> |
||
Line 12: | Line 12: | ||
|category = Primary Module |
|category = Primary Module |
||
|nottitlematch = %volume%¦%page selection% |
|nottitlematch = %volume%¦%page selection% |
||
|uses |
|uses = Template:DPL Parameter |
||
|include |
|include = {dpl manual}:,{DPL parameter}.surrogateexample |
||
|mode |
|mode = userformat |
||
|listseparators = ¶{¦class="wikitable sortable" ¶!colspan=3¦Includes a phantom template¶¦-¶!Page ¶!Name ¶!Purpose,¶¦-¶¦[[%PAGE%]]¶,¶¦-¶¦class="dpl-dark-background" colspan=3¦,¶¦} |
|listseparators = ¶{¦class="wikitable sortable" ¶!colspan=3¦Includes a surrogate (phantom) template¶¦-¶!Page ¶!Name ¶!Purpose,¶¦-¶¦[[%PAGE%]]¶,¶¦-¶¦class="dpl-dark-background" colspan=3¦,¶¦} |
||
|secseparators = ,¶¦class="dpl-orange-background"¦, |
|secseparators = ,¶¦class="dpl-orange-background"¦, |
||
|multisecseparators = ,¶¦-¶¦¶¦class="dpl-blue-background"¦ |
|multisecseparators = ,¶¦-¶¦¶¦class="dpl-blue-background"¦ |
||
Line 25: | Line 25: | ||
|category = Primary Module |
|category = Primary Module |
||
|nottitlematch = %volume%¦%page selection% |
|nottitlematch = %volume%¦%page selection% |
||
|uses |
|uses = Template:DPL Parameter |
||
|include |
|include = {dpl manual}:,{DPL parameter}.surrogateexample |
||
|mode |
|mode = userformat |
||
|listseparators = ¶{¦class="wikitable sortable" ¶!colspan=3¦Includes a phantom template¶¦-¶!Page ¶!Name ¶!Purpose,¶¦-¶¦[[%PAGE%]]¶,¶¦-¶¦class="dpl-dark-background" colspan=3¦,¶¦} |
|listseparators = ¶{¦class="wikitable sortable" ¶!colspan=3¦Includes a surrogate (phantom) template¶¦-¶!Page ¶!Name ¶!Purpose,¶¦-¶¦[[%PAGE%]]¶,¶¦-¶¦class="dpl-dark-background" colspan=3¦,¶¦} |
||
|secseparators = ,¶¦class="dpl-orange-background"¦, |
|secseparators = ,¶¦class="dpl-orange-background"¦, |
||
|multisecseparators = ,¶¦-¶¦¶¦class="dpl-blue-background"¦ |
|multisecseparators = ,¶¦-¶¦¶¦class="dpl-blue-background"¦ |
Latest revision as of 05:35, 1 April 2023
Example
This example uses a surrogate (also known as phantom) template to format the second and third column of results. The first column is included in the listseparators
statement, to prevent the page name from being repeated in every subsequent line. The second and third column, formatted in the surrogate, creates a link to the page's parameter name section, and then display the "purpose" text using Parser Functions. This combination of formatting the page name in a "separators" format statement and a surrogate template, results in templates used multiple times on a page to be separated into separate table rows under the parent page name (normally repeat templates used on a page are combined into a single row). This example is advanced, for more, simple examples of surrogate template use see include examples as related to including contents from templates, see the table
and tablerow
parameters for straightforward table examples.
{{#dpl: |category = Primary Module |nottitlematch = %volume%¦%page selection% |uses = Template:DPL Parameter |include = {dpl manual}:,{DPL parameter}.surrogateexample |mode = userformat |listseparators = ¶{¦class="wikitable sortable" ¶!colspan=3¦Includes a surrogate (phantom) template¶¦-¶!Page ¶!Name ¶!Purpose,¶¦-¶¦[[%PAGE%]]¶,¶¦-¶¦class="dpl-dark-background" colspan=3¦,¶¦} |secseparators = ,¶¦class="dpl-orange-background"¦, |multisecseparators = ,¶¦-¶¦¶¦class="dpl-blue-background"¦ }}
Result
{{#dpl: |category = Primary Module |nottitlematch = %volume%¦%page selection% |uses = Template:DPL Parameter |include = {dpl manual}:,{DPL parameter}.surrogateexample |mode = userformat |listseparators = ¶{¦class="wikitable sortable" ¶!colspan=3¦Includes a surrogate (phantom) template¶¦-¶!Page ¶!Name ¶!Purpose,¶¦-¶¦%PAGE%¶,¶¦-¶¦class="dpl-dark-background" colspan=3¦,¶¦} |secseparators = ,¶¦class="dpl-orange-background"¦, |multisecseparators = ,¶¦-¶¦¶¦class="dpl-blue-background"¦ }}