Flatlist/doc

From Eating Asturias, the Encyclopedia of Asturian Gastronomy
en>ENeRZet
(text editing)
m (1 revision imported)
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Documentation subpage}}
{{Documentation subpage}}
<!-- Add categories where indicated at the bottom of this page and interwikis at Wikidata -->
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->
{{Uses TemplateStyles|Template:Flatlist/styles.css}}
This template provides a WCAG/ISO-standards-compliant accessible alternative to comma or dash (or other single character) separated lists.


== Usage ==
===Usage===
{{Tlx|flatlist}} starts a horizontal list, such as:
{{tl|Flatlist}} starts a horizontal list, such as:
{{flatlist}}
*[[Cookbook:Appetizers|Appetizers]]
*[[Cookbook:Beverages|Beverages]]
*[[Cookbook:Bread Recipes|Bread]]
*[[Cookbook:Breakfast Recipes|Breakfast]]
*[[Cookbook:Confections|Confections]]
*[[Cookbook:Dessert|Desserts]]
*[[Cookbook:Meat Recipes|Meats]]
*[[Cookbook:Pasta Recipes|Pasta]]
*[[Cookbook:Rice Recipes|Rice]]
*[[Cookbook:Salad Recipes|Salads]]
{{endflatlist}}
The bottom margin is inherited from the current container. Normally this will be 0.5em. This template can be used with or without {{tl|endflatlist}}.


{{flatlist|
For navigation boxes using {{tl|navbox}}, one can set {{para|listclass|hlist}}, and achieve the same styling without using this template.
* cat
* dog
* horse
* cow
* sheep
* pig
}}
 
== Parameters ==
{{TemplateData header}}
<templatedata>
{
"description": {
"en": "Used to create plain (i.e. unbulleted) lists.",
"cs": "Používá se k vytváření jednoduchých (tj. bez odrážek) seznamů."
},
"format": "inline",
"params": {
"1": {
"label": {
"en": "Content",
"cs": "Obsah"
},
"description": {
"en": "The list to wrap.",
"cs": "Seznam k zabalení."
},
"suggested": true,
"type": "content"
},
"class": {
"label": {
"en": "Extra Classes",
"cs": "Extra třídy"
},
"description": {
"en": "Adds extra CSS classes to the containing div.",
"cs": "Přidá další třídy CSS do obsahující div."
},
"type": "string"
},
"style": {
"label": {
"en": "CSS Style",
"cs": "Styl CSS"
},
"description": {
"en": "Adds extra CSS properties to the containing div.",
"cs": "Přidá další vlastnosti CSS do obsahující div."
},
"example": "\n border: solid 1px silver;\n background: lightyellow;\n",
"type": "string"
},
"indent": {
"label": {
"en": "Indent",
"cs": "Odrážka"
},
"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.",
"cs": "Odsadí seznam o několik standardních odsazení (jedna odrážka je 1,6 em), což je zvláště užitečné pro zahrnutí do odsazeného diskusního vlákna."
},
"example": "2",
"type": "number"
}
},
"paramOrder": [
"class",
"style",
"indent",
"1"
]
}
</templatedata>
 
== Examples ==
<syntaxhighlight lang="moin">
{{flatlist|
* cat
* dog
* horse
* cow
* sheep
* pig
}}
</syntaxhighlight>
 
produces:
 
{{flatlist|
* cat
* dog
* horse
* cow
* sheep
* pig
}}


=== Syntax for ordered lists ===
===Examples===
<pre>
<pre><nowiki>
{{flatlist|
{{flatlist |
# first
*[[Cookbook:Appetizers|Appetizers]]
# second
*[[Cookbook:Beverages|Beverages]]
# third
*[[Cookbook:Bread Recipes|Bread]]
# fourth
*[[Cookbook:Breakfast Recipes|Breakfast]]
# fifth
*[[Cookbook:Confections|Confections]]
# sixth
*[[Cookbook:Dessert|Desserts]]
*[[Cookbook:Meat Recipes|Meats]]
*[[Cookbook:Pasta Recipes|Pasta]]
*[[Cookbook:Rice Recipes|Rice]]
*[[Cookbook:Salad Recipes|Salads]]
}}
}}
</pre>
</nowiki></pre>


produces:
{{flatlist |
 
*[[Cookbook:Appetizers|Appetizers]]
{{flatlist|
*[[Cookbook:Beverages|Beverages]]
# first
*[[Cookbook:Bread Recipes|Bread]]
# second
*[[Cookbook:Breakfast Recipes|Breakfast]]
# third
*[[Cookbook:Confections|Confections]]
# fourth
*[[Cookbook:Dessert|Desserts]]
# fifth
*[[Cookbook:Meat Recipes|Meats]]
# sixth
*[[Cookbook:Pasta Recipes|Pasta]]
*[[Cookbook:Rice Recipes|Rice]]
*[[Cookbook:Salad Recipes|Salads]]
}}
}}


=== Using optional parameters ===
;Alternative syntax:
<syntaxhighlight lang="moin">
<pre><nowiki>
{{flatlist |indent=2
{{flatlist}}
|style=border:solid 1px silver; background:lightyellow;
*[[Cookbook:Appetizers|Appetizers]]
|class=nowraplinks |
*[[Cookbook:Beverages|Beverages]]
* Alpine skiing at the 1936 Winter Olympics
*[[Cookbook:Bread Recipes|Bread]]
* Alpine skiing at the 1948 Winter Olympics
*[[Cookbook:Breakfast Recipes|Breakfast]]
* Alpine skiing at the 1952 Winter Olympics
*[[Cookbook:Confections|Confections]]
* Alpine skiing at the 1956 Winter Olympics
*[[Cookbook:Dessert|Desserts]]
* Alpine skiing at the 1960 Winter Olympics
*[[Cookbook:Meat Recipes|Meats]]
* Alpine skiing at the 1964 Winter Olympics
*[[Cookbook:Pasta Recipes|Pasta]]
}}
*[[Cookbook:Rice Recipes|Rice]]
</syntaxhighlight>
*[[Cookbook:Salad Recipes|Salads]]
{{endflatlist}}
</nowiki></pre>


produces:
{{flatlist}}
*[[Cookbook:Appetizers|Appetizers]]
*[[Cookbook:Beverages|Beverages]]
*[[Cookbook:Bread Recipes|Bread]]
*[[Cookbook:Breakfast Recipes|Breakfast]]
*[[Cookbook:Confections|Confections]]
*[[Cookbook:Dessert|Desserts]]
*[[Cookbook:Meat Recipes|Meats]]
*[[Cookbook:Pasta Recipes|Pasta]]
*[[Cookbook:Rice Recipes|Rice]]
*[[Cookbook:Salad Recipes|Salads]]
{{endflatlist}}


{{flatlist |indent=2 |style=border:solid 1px silver; background:lightyellow; |class=nowraplinks |
;Syntax for ordered lists:
* Alpine skiing at the 1936 Winter Olympics
<pre><nowiki>
* Alpine skiing at the 1948 Winter Olympics
{{flatlist | class=hnum |
* Alpine skiing at the 1952 Winter Olympics
#[[Cookbook:Appetizers|Appetizers]]
* Alpine skiing at the 1956 Winter Olympics
#[[Cookbook:Beverages|Beverages]]
* Alpine skiing at the 1960 Winter Olympics
#[[Cookbook:Bread Recipes|Bread]]
* Alpine skiing at the 1964 Winter Olympics
#[[Cookbook:Breakfast Recipes|Breakfast]]
#[[Cookbook:Confections|Confections]]
#[[Cookbook:Dessert|Desserts]]
#[[Cookbook:Meat Recipes|Meats]]
#[[Cookbook:Pasta Recipes|Pasta]]
#[[Cookbook:Rice Recipes|Rice]]
#[[Cookbook:Salad Recipes|Salads]]
}}
}}
</nowiki></pre>


== Technical details ==
{{flatlist | class=hnum |
This template uses the <code>.hlist</code> [[w:Cascading Style Sheets|CSS]] class defined in the TemplateStyles to generate horizontal lists. It causes ordinary HTML list items to be displayed inline (horizontally), where they would normally display as block elements (vertically). The class also generates the interpuncts between list items and parentheses around nested lists.
#[[Cookbook:Appetizers|Appetizers]]
 
#[[Cookbook:Beverages|Beverages]]
{| class="wikitable"
#[[Cookbook:Bread Recipes|Bread]]
! Wikitext
#[[Cookbook:Breakfast Recipes|Breakfast]]
! Expanded template
#[[Cookbook:Confections|Confections]]
! HTML
#[[Cookbook:Dessert|Desserts]]
|- style="vertical-align:top;"
#[[Cookbook:Meat Recipes|Meats]]
| <pre>
#[[Cookbook:Pasta Recipes|Pasta]]
{{flatlist|
#[[Cookbook:Rice Recipes|Rice]]
* cat
#[[Cookbook:Salad Recipes|Salads]]
* dog
* horse
* cow
* sheep
* pig
}}
</pre>
| {{#tag:pre|
{{flatlist|
* cat
* dog
* horse
* cow
* sheep
* pig
}}
}}
}}
| <syntaxhighlight lang="html">
<div class="hlist">
<ul><li>cat</li>
<li>dog</li>
<li>horse</li>
<li>cow</li>
<li>sheep</li>
<li>pig</li></ul>
</div>
</syntaxhighlight>
|}


== See also ==
===Parameters===
* {{tlx|multi-column numbered list}}
* '''class''' – adds a CSS class to the containing div.
* {{tlx|nowrap}}
* '''style''' – adds CSS style options.
* {{tlx|pagelist}}
::Example: {{para|<var>style</var>|<var>border:solid 1px silver; background:lightyellow</var>}}
* {{tlx|Hlist}} – Uses [[Module:List]]
* '''indent''' – indents the list by a number of standard indents (one indent being 1.6em), particularly handy for inclusion in an indented discussion thread.
* {{ll|Help:Lists}}
::Example: {{para|<var>indent</var>|<var>2</var>}}


{{navbox lists}}
===See also===
<includeonly>{{Sandbox other||
* {{tl|endflatlist}}
<!-- Categories below this line; interwikis at Wikidata -->
* {{tl|plainlist}}
[[Category:Typing-aid templates{{#translation:}}]]
* {{tl|unbulleted list}}
[[Category:Formatting templates{{#translation:}}]]
<includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox||
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[ka:თარგი:Flatlist]]
[[Category:List formatting templates|{{PAGENAME}}]]
}}</includeonly>
}}</includeonly>

Latest revision as of 18:17, 25 October 2022

Usage

{{Flatlist}} starts a horizontal list, such as:

The bottom margin is inherited from the current container. Normally this will be 0.5em. This template can be used with or without {{endflatlist}}.

For navigation boxes using {{navbox}}, one can set |listclass=hlist, and achieve the same styling without using this template.

Examples

{{flatlist |
*[[Cookbook:Appetizers|Appetizers]]
*[[Cookbook:Beverages|Beverages]]
*[[Cookbook:Bread Recipes|Bread]]
*[[Cookbook:Breakfast Recipes|Breakfast]]
*[[Cookbook:Confections|Confections]]
*[[Cookbook:Dessert|Desserts]]
*[[Cookbook:Meat Recipes|Meats]]
*[[Cookbook:Pasta Recipes|Pasta]]
*[[Cookbook:Rice Recipes|Rice]]
*[[Cookbook:Salad Recipes|Salads]]
}}
Alternative syntax
{{flatlist}}
*[[Cookbook:Appetizers|Appetizers]]
*[[Cookbook:Beverages|Beverages]]
*[[Cookbook:Bread Recipes|Bread]]
*[[Cookbook:Breakfast Recipes|Breakfast]]
*[[Cookbook:Confections|Confections]]
*[[Cookbook:Dessert|Desserts]]
*[[Cookbook:Meat Recipes|Meats]]
*[[Cookbook:Pasta Recipes|Pasta]]
*[[Cookbook:Rice Recipes|Rice]]
*[[Cookbook:Salad Recipes|Salads]]
{{endflatlist}}
Syntax for ordered lists
{{flatlist | class=hnum |
#[[Cookbook:Appetizers|Appetizers]]
#[[Cookbook:Beverages|Beverages]]
#[[Cookbook:Bread Recipes|Bread]]
#[[Cookbook:Breakfast Recipes|Breakfast]]
#[[Cookbook:Confections|Confections]]
#[[Cookbook:Dessert|Desserts]]
#[[Cookbook:Meat Recipes|Meats]]
#[[Cookbook:Pasta Recipes|Pasta]]
#[[Cookbook:Rice Recipes|Rice]]
#[[Cookbook:Salad Recipes|Salads]]
}}

Parameters

  • class – adds a CSS class to the containing div.
  • style – adds CSS style options.
Example: |style=border:solid 1px silver; background:lightyellow
  • indent – indents the list by a number of standard indents (one indent being 1.6em), particularly handy for inclusion in an indented discussion thread.
Example: |indent=2

See also