Template:Plainlist/doc: Difference between revisions
More actions
comment out code which does not work on the template page |
Fix language-code links to use Wikipedia interwiki prefixes |
||
| (6 intermediate revisions by 5 users not shown) | |||
| Line 1: | Line 1: | ||
{{Documentation subpage}} | {{Documentation subpage}} | ||
<!-- | <!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata --> | ||
{{Uses TemplateStyles|Template:Plainlist/styles.css}} | |||
This template provides a [[ | This template provides a [[w:Web Content Accessibility Guidelines|WCAG]]/ISO-standards-compliant accessible alternative to {{tag|br|s}} separated lists, which should not be used. | ||
==Usage== | == Usage == | ||
{{ | {{tld|Plainlist}} starts a plain (i.e. unbulleted) list. <!-- apparently this does not work on the template page at Commons | ||
{{ | {{Plainlist| | ||
* [[cat]] | * [[cat]] | ||
* [[dog]] | * [[dog]] | ||
| Line 13: | Line 14: | ||
* [[sheep]] | * [[sheep]] | ||
* [[pig]] | * [[pig]] | ||
}}-->It uses proper HTML list markup, which is more standards-compliant and more accessible than separating list items with {{tag|br|s}}. Detailed reasons for using this template can be found at [[: | }}-->It uses proper HTML list markup, which is more standards-compliant and more accessible than separating list items with {{tag|br|s}}. Detailed reasons for using this template can be found at [[w:WP:UBLIST|WP:UBLIST]]. | ||
==Examples== | == Examples == | ||
< | <syntaxhighlight lang="wikitext"> | ||
{{ | {{Plainlist| | ||
* [[cat]] | * [[cat]] | ||
* [[dog]] | * [[dog]] | ||
| Line 25: | Line 26: | ||
* [[pig]] | * [[pig]] | ||
}} | }} | ||
</ | </syntaxhighlight> | ||
<!--{{ | <!--{{Plainlist| | ||
* [[cat]] | * [[cat]] | ||
* [[dog]] | * [[dog]] | ||
| Line 34: | Line 35: | ||
* [[pig]] | * [[pig]] | ||
}}--> | }}--> | ||
==Parameters== | == Parameters == | ||
* | {{TemplateData header}} | ||
<templatedata> | |||
: | { | ||
"description": { | |||
:: | "en": "Used to create plain (i.e. unbulleted) lists." | ||
}, | |||
"format": "inline", | |||
"params": { | |||
"1": { | |||
"label": { | |||
"en": "Content" | |||
}, | |||
"description": { | |||
"en": "The items to include in the list. Each item list should be on its own line starting with an asterisk." | |||
}, | |||
"example": "\n {{Plainlist|\n * item1\n * item2\n * item3\n }}\n", | |||
"suggested": true, | |||
"type": "content" | |||
}, | |||
"class": { | |||
"label": { | |||
"en": "Extra Classes" | |||
}, | |||
"description": { | |||
"en": "Adds extra CSS classes to the containing div." | |||
}, | |||
"type": "string" | |||
}, | |||
"style": { | |||
"label": { | |||
"en": "CSS Style" | |||
}, | |||
"description": { | |||
"en": "Adds extra CSS properties. Complex styles should not be used in articles (per [[w:MOS:DEVIATIONS]]) but may be acceptable on user, project, and talk pages." | |||
}, | |||
"example": "\n border: solid 1px silver;\n background: lightyellow;\n", | |||
"type": "string" | |||
}, | |||
"indent": { | |||
"label": { | |||
"en": "Indent" | |||
}, | |||
"description": { | |||
"en": "Indents the list by a number of standard indents (one indent being 1.6em), particularly handy for inclusion in an indented discussion thread." | |||
}, | |||
"example": "2", | |||
"type": "number" | |||
} | |||
}, | |||
"paramOrder": [ | |||
"class", | |||
"style", | |||
"indent", | |||
"1" | |||
] | |||
} | |||
</templatedata> | |||
==Method== | ==Method== | ||
{{ | {{tld|plainlist}} works by constructing a div with the CSS class "plainlist" which has [[Template:Plainlist/styles.css|the following style]]: | ||
{{#tag:syntaxhighlight| | |||
{{Template:Plainlist/styles.css}} | |||
| lang="css" | |||
}} | |||
} | |||
} | |||
== See also == | |||
<includeonly>{{ | <includeonly>{{Sandbox other|| | ||
<!-- | <!-- Categories below this line; interwikis at Wikidata --> | ||
[[Category:Formatting templates|Plainlist]] | [[Category:Formatting templates|Plainlist]] | ||
[[Category:Templates not requiring internationalization|Plainlist]] | [[Category:Templates not requiring internationalization|Plainlist]] | ||
}}</includeonly> | }}</includeonly> | ||
Latest revision as of 14:22, 15 August 2026
This template provides a WCAG/ISO-standards-compliant accessible alternative to <br /> separated lists, which should not be used.
Usage
{{Plainlist}} starts a plain (i.e. unbulleted) list. It uses proper HTML list markup, which is more standards-compliant and more accessible than separating list items with <br />. Detailed reasons for using this template can be found at WP:UBLIST.
Examples
{{Plainlist|
* [[cat]]
* [[dog]]
* [[horse]]
* [[cow]]
* [[sheep]]
* [[pig]]
}}
Parameters
- TemplateData
TemplateData is a way to store information about template parameters (the description of those and of the whole template) for both humans and machines. It is used by VisualEditor and possibly other tools like Upload Wizard.
Existing template documentation
At Wikimedia Commons, it is recommended to use {{TemplateBox}} with either useTemplateData=1 or useTemplateData=only on the /doc subpage and transcluding it with {{Documentation}} into the template. <nowiki>-tags can be wrapped around the arguments, if required, to avoid templates being expanded.
Newly created template documentation and imports
Another option, especially for imported templates, or for users with JSON experience, is placing raw <templatedata>-tags into the Wikitext of the template, as described in various Wikipediae.
Wikipedia's help about TemplateData • Commons-specific information
Used to create plain (i.e. unbulleted) lists.
| Parameter | Description | Type | Status | |
|---|---|---|---|---|
| Extra Classes | class | Adds extra CSS classes to the containing div. | String | optional |
| CSS Style | style | Adds extra CSS properties. Complex styles should not be used in articles (per [[w:MOS:DEVIATIONS]]) but may be acceptable on user, project, and talk pages.
| String | optional |
| Indent | indent | Indents the list by a number of standard indents (one indent being 1.6em), particularly handy for inclusion in an indented discussion thread.
| Number | optional |
| Content | 1 | The items to include in the list. Each item list should be on its own line starting with an asterisk.
| Content | suggested |
Method
{{plainlist}} works by constructing a div with the CSS class "plainlist" which has the following style:
/* Should be kept in sync with [[MediaWiki:Common.css]] */
/**
* Unbulleted lists
*/
.plainlist ul {
line-height: inherit;
list-style: none none;
margin: 0;
}
.plainlist ul li {
margin-bottom: 0;
}