Difference between revisions of "Template:Hlist/doc"
en>Jonesey95 (→Avoiding Linter errors: rm smaller post-merge) |
m (1 revision imported) |
Latest revision as of 04:45, 7 June 2022
{{#ifeq:doc |doc
|
{{#ifeq:show |show
| Template:Mbox }}{{#if: | | {{#ifexist:Template:Hlist | [[Category:{{#switch:Template |Template=Template |Module=Module |User=User |#default=Wikipedia}} documentation pages]] | }} }} | }}
{{#invoke:High-use|main|1=|2=|system={{#if:in MediaWiki:Citethispage-content|in MediaWiki:Citethispage-content|in system messages}}}} {{#invoke:Lua banner|main}} {{#invoke:Shortcut|main|template=yes|redirect=yes}}
This template creates horizontal lists. Each item in the list may be individually styled with CSS.
Usage
Basic usage
<templatestyles src="Pre/styles.css"/>
{{#if:{{hlist|first item|second item|third item|...}}|{{hlist|first item|second item|third item|...}}}}{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||{{{16}}}}}{{#if:||{{{17}}}}}{{#if:||{{{18}}}}}{{#if:||{{{19}}}}}{{#if:||{{{20}}}}}
All parameters
<templatestyles src="Pre/styles.css"/>
{{#if: {{hlist |first item|second item|third item|... |class = class for div tag |style = style for div tag |list_style = style for ul tag |item_style = style for all li tags |item1_style = style for first li tag |item2_style = style for second li tag |... |indent = the number of tabs to indent }} | {{hlist |first item|second item|third item|... |class = class for div tag |style = style for div tag |list_style = style for ul tag |item_style = style for all li tags |item1_style = style for first li tag |item2_style = style for second li tag |... |indent = the number of tabs to indent }} }}{{#if:||{{{2}}}}}{{#if:||{{{3}}}}}{{#if:||{{{4}}}}}{{#if:||{{{5}}}}}{{#if:||{{{6}}}}}{{#if:||{{{7}}}}}{{#if:||{{{8}}}}}{{#if:||{{{9}}}}}{{#if:||{{{10}}}}}{{#if:||{{{11}}}}}{{#if:||{{{12}}}}}{{#if:||{{{13}}}}}{{#if:||{{{14}}}}}{{#if:||{{{15}}}}}{{#if:||{{{16}}}}}{{#if:||{{{17}}}}}{{#if:||{{{18}}}}}{{#if:||{{{19}}}}}{{#if:||{{{20}}}}}
Parameters
- Positional parameters (
1
,2
,3
...): these are the list items. If no list items are present, the module will output nothing. class
: a custom class for the{{#switch:pair
|c|close = |e|empty|s|single|v|void |o|open |p|pair = <{{#if:|div|div}}{{#if:| {{{attribs}}}}} }}{{#switch:pair |c|close = |e|empty|s|single|v|void = /> |o|open = > |p|pair = {{#ifeq:div|!--||>}}... }}{{#switch:pair |e|empty|s|single|v|void |o|open = |c|close |p|pair = {{#ifeq:div|!--|-->|</div>}} }}
tags surrounding the list. Set toinline
when using {{#Invoke:Template link general|main|nowrap=yes|nolink=yes}} inside text.
style
: a custom CSS style for the{{#switch:pair
|c|close = |e|empty|s|single|v|void |o|open |p|pair = <{{#if:|div|div}}{{#if:| {{{attribs}}}}} }}{{#switch:pair |c|close = |e|empty|s|single|v|void = /> |o|open = > |p|pair = {{#ifeq:div|!--||>}}... }}{{#switch:pair |e|empty|s|single|v|void |o|open = |c|close |p|pair = {{#ifeq:div|!--|-->|</div>}} }}
tags surrounding the list, e.g.font-size: 90%;
.
list_style
: a custom CSS style for the{{#switch:pair
|c|close = |e|empty|s|single|v|void |o|open |p|pair = <{{#if:|ul|ul}}{{#if:| {{{attribs}}}}} }}{{#switch:pair |c|close = |e|empty|s|single|v|void = /> |o|open = > |p|pair = {{#ifeq:ul|!--||>}}... }}{{#switch:pair |e|empty|s|single|v|void |o|open = |c|close |p|pair = {{#ifeq:ul|!--|-->|</ul>}} }}
tags around the list. The format is the same as for the|{{SAFESUBST:#if:style|style=}}
parameter.
item_style
: a custom CSS style for all of the list items (the{{#switch:pair
|c|close = |e|empty|s|single|v|void |o|open |p|pair = <{{#if:|li|li}}{{#if:| {{{attribs}}}}} }}{{#switch:pair |c|close = |e|empty|s|single|v|void = /> |o|open = > |p|pair = {{#ifeq:li|!--||>}}... }}{{#switch:pair |e|empty|s|single|v|void |o|open = |c|close |p|pair = {{#ifeq:li|!--|-->|</li>}} }}
tags). The format is the same as for the|{{SAFESUBST:#if:style|style=}}
parameter.
item1_style
,item2_style
,item3_style
...: custom CSS styles for each of the list items. The format is the same as for the|{{SAFESUBST:#if:style|style=}}
parameter.indent
: the number of tabs to indent the list. Default value is 0.
Examples
{{#if: ||+ {{{title}}}}} {{#if: |Markup | Renders as
}}{{safesubst:#invoke:For loop|main}} |
Avoiding Linter errors
{{#Invoke:Template link general|main|nowrap=yes|nolink=yes}} will produce Linter errors if placed inside a template that uses {{#switch:pair
|c|close =
|e|empty|s|single|v|void
|o|open
|p|pair = <{{#if:|span|span}}{{#if:| {{{attribs}}}}}
}}{{#switch:pair
|c|close =
|e|empty|s|single|v|void = />
|o|open = >
|p|pair = {{#ifeq:span|!--||>}}...
}}{{#switch:pair
|e|empty|s|single|v|void
|o|open =
|c|close
|p|pair = {{#ifeq:span|!--|-->|</span>}}
}}
tags, such as {{small}}, {{larger}}, etc. To avoid this, use the substitutions from the table below:
hidable|collapsible = collapsible | autocollapse = collapsible autocollapse | collapse|collapsed = collapsible collapsed | sortable = sortable | outercollapse = outercollapse | innercollapse = innercollapse |
}} {{safesubst:#switch: |
hidable|collapsible = collapsible | autocollapse = collapsible autocollapse | collapse|collapsed = collapsible collapsed | sortable = sortable | outercollapse = outercollapse | innercollapse = innercollapse |
}} {{safesubst:#switch: |
hidable|collapsible = collapsible | autocollapse = collapsible autocollapse | collapse|collapsed = collapsible collapsed | sortable = sortable | outercollapse = outercollapse | innercollapse = innercollapse |
}} " |
Incorrect markup | Correct markup |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{{small|{{hlist|...}}}} |
{{hlist|...|style=font-size:85%}}
| |||||||||||||||||||||
{{resize|{{hlist|...}}}} |
{{hlist|...|style=font-size:90%}}
| |||||||||||||||||||||
{{midsize|{{hlist|...}}}} |
{{hlist|...|style=font-size:92%}}
| |||||||||||||||||||||
{{larger|{{hlist|...}}}} |
{{hlist|...|style=font-size:110%}}
| |||||||||||||||||||||
{{big|{{hlist|...}}}} |
{{hlist|...|style=font-size:120%}}
| |||||||||||||||||||||
{{large|{{hlist|...}}}} |
{{hlist|...|style=font-size:large}}
| |||||||||||||||||||||
{{huge|{{hlist|...}}}} |
{{hlist|...|style=font-size:180%}}
| |||||||||||||||||||||
{{resize|x%|{{hlist|...}}}} |
{{hlist|...|style=font-size:x%}}
| |||||||||||||||||||||
{{font|size=x%|{{hlist|...}}}} |
{{hlist|...|style=font-size:x%}}
| |||||||||||||||||||||
{{nowrap|{{hlist|...}}}} |
{{hlist|...|style=white-space: nowrap}}
|
{{#invoke:navbox top and bottom|top}}
Flat |
|
|
| |||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Bulleted and Ordered |
|
| ||||||||||||||||||||||||||||||||||||||
Unbulleted |
|
|
| |||||||||||||||||||||||||||||||||||||
Other |
|
|
|
{{#invoke:navbox top and bottom|bottom}}