|
|
(3 intermediate revisions by the same user not shown) |
Line 1: |
Line 1: |
| {{Documentation subpage}} | | {{doc sub}} |
| <!-- EDIT TEMPLATE DOCUMENTATION BELOW THIS LINE -->
| |
| {{high-use| 15791 }}
| |
| {{lua|Module:Pagelist}}
| |
|
| |
|
| ==Usage==
| | This is a Lua implementation of {{tl|pagelist}}. Please see the template page for documentation. |
| This template creates a comma-separated list of pages formatted as links. The last two pages in the list are separated by "and" instead of a comma. Any number of pages may be included in the list. | |
|
| |
|
| By default, the namespace of the page including this template is used for each of the links. An optional <code>'''''nspace'''''</code> parameter can be specified to provide a different namespace to use for the links. {{para|nspace|all}} Makes the parameters namespace-aware, i.e. not default to the mainspace.
| | <includeonly> |
| | | [[Category:Modules]] |
| Two other optional parameters are supported to provide formatting of the page links. If specified, the <code>'''delim'''</code> parameter is included before and after each page name. Optionally, the <code>'''edelim'''</code> parameter can specify the delimiter used at the end of the page name—in this case the <code>'''delim'''</code> tag is still used for the beginning of the page name.
| | </includeonly> |
| | | <noinclude> |
| It is possible to specify a custom separator (instead of a comma) using the <code>'''separator'''</code> parameter. It is also possible to specify a custom value to use instead of "and" before the final item using the <code>'''conjunction'''</code> parameter. For both of these parameters, there are special values that use the default separators for the language set in users' preferences: <code>''dot''</code> (<code>{{int:dot-separator}}</code>), <code>''pipe''</code> (<code>{{int:pipe-separator}}</code>), <code>''comma''</code> (<code>{{int:comma-separator}}</code>), or <code>''tpt-languages''</code> (<code>{{int:tpt-languages-separator}}</code>).
| | [[Category:Module documents]] |
| | | </noinclude> |
| This template is mostly useful from within other templates that accept a variable number of page names, up to twenty pages, as arguments. For example, the page arguments <code><nowiki>{{{1}}}</nowiki></code>–<code><nowiki>{{{10}}}</nowiki></code> can be passed to this template using <code><nowiki>{{pagelist|{{{1|}}}|{{{2|}}}|{{{3|}}}|{{{4|}}}|{{{5|}}}|{{{6|}}}|{{{7|}}}|{{{8|}}}|{{{9|}}}|{{{10|}}}}}</nowiki></code>. Any parameters not specified to the original template will be passed as empty parameters and not listed by the pagelist template.
| |
| | |
| ===Examples===
| |
| {| class="wikitable"
| |
| ! Type this !! To get this
| |
| |-
| |
| | <code><nowiki>{{Pagelist|X1|X2|X3|X4|X5}}</nowiki></code>
| |
| | {{Pagelist|X1|X2|X3|X4|X5}}
| |
| |-
| |
| | <code><nowiki>{{Pagelist|nspace=Template|X1|X2|X3|X4|X5}}</nowiki></code>
| |
| | {{Pagelist|nspace=Template|X1|X2|X3|X4|X5}}
| |
| |-
| |
| | <code><nowiki>{{Pagelist|nspace= |delim=''|X1|X2|X3|X4|X5}}</nowiki></code>
| |
| | {{Pagelist|nspace= |delim=''|X1|X2|X3|X4|X5}}
| |
| |-
| |
| | <code><nowiki>{{Pagelist|nspace=all|delim=''|Portal:Birds|Wikipedia:Template editor}}</nowiki></code>
| |
| | {{Pagelist|nspace=all|delim=''|Portal:Birds|Wikipedia:Template editor}}
| |
| |-
| |
| | <code><nowiki>{{Pagelist|X1}}</nowiki></code>
| |
| | {{Pagelist|X1}}
| |
| |-
| |
| | <code><nowiki>{{Pagelist}}</nowiki></code>
| |
| | {{Pagelist}}
| |
| |-
| |
| | <code><nowiki>{{Pagelist|X1|X2|X3|separator=;}}</nowiki></code>
| |
| | {{Pagelist|X1|X2|X3|separator=;}}
| |
| |-
| |
| | <code><nowiki>{{Pagelist|X1|X2|X3|separator=;&#32;}}</nowiki></code>
| |
| | {{Pagelist|X1|X2|X3|separator=; }}
| |
| |-
| |
| | <code><nowiki>{{Pagelist|X1|X2|X3|conjunction=or}}</nowiki></code>
| |
| | {{Pagelist|X1|X2|X3|conjunction=or}}
| |
| |-
| |
| | <code><nowiki>{{Pagelist|X1|X2|X3|conjunction=&#32;or&#32;}}</nowiki></code>
| |
| | {{Pagelist|X1|X2|X3|conjunction= or }}
| |
| |}
| |
| | |
| == Parameters ==
| |
| {{TemplateDataHeader}}
| |
| <templatedata>
| |
| {
| |
| "params": {
| |
| "nspace": {
| |
| "label": "Namespace",
| |
| "description": "Namespace on which the page is located, without the trailing colon (\":\"). Acceptable values are \"Talk\", \"File\", \"File talk\", \"Category\", \"Category talk\", \"Help\", \"Help talk\", \"Wikipedia\", \"Wikipedia talk\", \"Portal\", \"Portal talk\", \"Template\", \"Template talk\", \"Module\", \"Module talk\", \"User\", \"User talk\", and anything added in the future. \"all\" allows specifying lists of pages from multiple namespaces",
| |
| "example": "Template",
| |
| "type": "string"
| |
| },
| |
| "delim": {
| |
| "label": "Prefix (starting delimiter)",
| |
| "description": "Wikicode to insert before each page name. Default is nothing. If this parameter is specified and no suffix parameter is specified, the contents of this parameter would also be used as the suffix.",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "edelim": {
| |
| "label": "Suffix (ending delimiter)",
| |
| "description": "Wikicode to insert after each page name. If not specified, the default is the value of the prefix parameter.",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "separator": {
| |
| "label": "Separator",
| |
| "description": "The character(s) used to separate specified page names, excluding the last two. Default is comma.",
| |
| "example": ";",
| |
| "type": "string"
| |
| },
| |
| "conjunction": {
| |
| "label": "Conjunction",
| |
| "description": "The character(s) used to separate the last two items. Default is \"and\".",
| |
| "example": "or",
| |
| "type": "string"
| |
| },
| |
| "1": {
| |
| "label": "Page name 1",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "2": {
| |
| "label": "Page name 2",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "3": {
| |
| "label": "Page name 3",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "4": {
| |
| "label": "Page name 4",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "5": {
| |
| "label": "Page name 5",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "6": {
| |
| "label": "Page name 6",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "7": {
| |
| "label": "Page name 7",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "8": {
| |
| "label": "Page name 8",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "9": {
| |
| "label": "Page name 9",
| |
| "type": "unbalanced-wikitext"
| |
| },
| |
| "10": {
| |
| "label": "Page name 10",
| |
| "type": "unbalanced-wikitext"
| |
| }
| |
| },
| |
| "format": "inline",
| |
| "description": "This template creates a comma-separated list of pages formatted as links. The last two pages in the list are separated by \"and\" instead of a comma. Any number of pages may be included in the list."
| |
| }
| |
| </templatedata> | |
| | |
| == See also ==
| |
| * {{tl|Article list}}, which converts a list of QIDs into wikilinks
| |
| * {{tl|Catlist}}, for a list of linked categories
| |
| * {{tl|Comma separated entries}}
| |
| * {{tl|Catalog lookup link}}
| |
| * {{tl|Prose list}}, an equivalent which does not wikilink
| |
| | |
| <includeonly>{{sandbox other|| | |
| [[Category:List formatting and function templates]] | |
| [[Category:Internal link templates]]
| |
| }}</includeonly>
| |