Jump to content
Toggle menu
  • 8 articles
  • 75 files
  • 7 users
  • 37.8K edits
Neodyland Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Plainlist/doc: Difference between revisions

Template page
comment out code which does not work on the template page
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- PLEASE ADD CATEGORIES AT THE BOTTOM OF THIS PAGE -->
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
{{Uses TemplateStyles|Template:Plainlist/styles.css}}


This template provides a [[:en:Web Content Accessibility Guidelines|WCAG]]/ISO-standards-compliant accessible alternative to <code><nowiki><br /></nowiki></code> separated lists, which should not be used.
This template provides a [[:en:Web Content Accessibility Guidelines|WCAG]]/ISO-standards-compliant accessible alternative to {{tag|br|s}} separated lists, which should not be used.


==Usage==
== Usage ==
{{tl|plainlist}} starts a plain (i.e. unbulleted) list. <!-- apparently this does not work on the template page at Commons
{{tld|plainlist}} starts a plain (i.e. unbulleted) list. <!-- apparently this does not work on the template page at Commons
{{plainlist|
{{plainlist|
* [[cat]]
* [[cat]]
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 [[:en:WP:UBLIST]].
}}-->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 [[:en:WP:UBLIST|WP:UBLIST]].


==Examples==
== Examples ==
<pre><nowiki>
<pre><nowiki>
{{plainlist|
{{plainlist|
Line 34: Line 35:
* [[pig]]
* [[pig]]
}}-->
}}-->
==Parameters==
== Parameters ==
* '''class''' – adds a CSS class to the containing div.
{{TemplateData header}}
* '''style''' – adds CSS style options. Complex styles should not be used in articles (per [[wp:deviations]]) but may be acceptable on user, project, and talk pages.
<templatedata>
::Example: {{para|<var>style</var>|<var>border:solid 1px silver; background:lightyellow</var>}}
{
* '''indent''' – indents the list by a number of standard indents (one indent being 1.6em), particularly handy for inclusion in an indented discussion thread.
"description": {
::Example: {{para|<var>indent</var>|<var>2</var>}}
"en": "Used to create plain (i.e. unbulleted) lists."
},
"format": "inline",
"params": {
"1": {
"label": {
"en": "Content"
},
"description": {
"en": "The list to wrap."
},
"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==
{{tl|Plainlist}} works by constructing a div with the CSS class "plainlist" which has the following style:
{{tld|plainlist}} works by constructing a div with the CSS class "plainlist" which has [[Template:Plainlist/styles.css|the following style]]:
<source lang="css">
{{#tag:syntaxhighlight|
.plainlist ul {
{{Template:Plainlist/styles.css}}
    line-height: inherit;
| lang="css"
    list-style: none none;
}}
    margin: 0;
}
.plainlist ul li {
    margin-bottom: 0;
}
</source>
 


<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
== See also ==
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
{{navbox lists}}
<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>

Revision as of 13:47, 11 July 2021

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>JSON</templatedata> ./. {{TemplateBox}}
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 TemplateDataCommons-specific information

Used to create plain (i.e. unbulleted) lists.

Template parameters

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
Extra Classesclass

Adds extra CSS classes to the containing div.

Stringoptional
CSS Stylestyle

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
border: solid 1px silver;
background: lightyellow;
Stringoptional
Indentindent

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
Numberoptional
Content1

The list to wrap.

Contentsuggested

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;
}

See also

Template:Navbox lists

Cookies help us deliver our services. By using our services, you agree to our use of cookies.