Examples/Parameter: secseparators (example 1)
Example
[edit source]
Using debug=0 supresses debug output. This lists pages in category Fruit examples using listseparators (an alias for format) to define a table start and headers with three columns, and to put a link to the page in the first column of each row. The includepage parameter specifies the template used on each page to pull the remaining data from, and their parameter names.
format=Startall,Start,End,Endall where Startall, Start, End and Endall are wiki tags used to separate the list items:
Startallbefore all — e.g., may specify wikitext to begin a table (including headers).Startbefore each — e.g., may specify wikitext to begin row, its cell and cell content.Endafter each — e.g., may specify content to end a cell or row.Endallafter all — e.g., may specify content to end a table.
|debug = 5 can be added to view any resultant wikitext given, and should always be put at the top of the statement, a value of 0 disables it.
The secseparators statement adds columns and cell formatting for each result. There are two pairs for each transcluded section; the first element of each pair is a linefeed and a pipe/split-pipe (which define a new column in the table) and the second element of each pair is empty. Look carefully at the ¶ symbols (\n can be used as an alternative), which always appear before a wiki syntax element and must be placed at the beginning of a new line ensuring the wiki parser understands them. The result is limited to a count of 3.
Note: If an article does not contain a value for the parameter named "grows", it results in an empty cell in the table.
- Code
{{#dpl:
|debug = 0
|category = Fruit examples
|listseparators = {¦class="wikitable" ¶!Fruit ¶!Image Filename ¶!Grows on,¶¦-¶¦[[%PAGE%|%TITLE%]],,¶¦}
|includepage = {Fruit-Infobox}:image:grows
|secseparators = ¶¦,,¶¦,,
|count = 3
}}
- Result
| Fruit | Image Filename | Grows on |
|---|---|---|
| Apple | Red Apple Fruit With Black Background.jpeg | On trees |
| Grape | Grapes on White Table.jpeg | On vines |
| Orange | Orange, orange peel.jpg | On trees |