Help:List
Lists are a way of organizing and ordering data. This page will explain how to create and edit lists on The Sims Wiki.
List basics[edit source]
There are three types of lists: unordered lists, ordered lists, and definition lists (or description lists).
You type | You get |
---|---|
* Lists are easy to do: ** start every line * with a star ** more stars mean *** deeper levels |
|
* A newline * in a list marks the end of the list. Of course * you can * start again. |
marks the end of the list. Of course
|
# Numbered lists are good ## very organized ## easy to follow |
|
Definition (description, association) lists: ; Term : Description or ; Term : Description Can be used for more than terms and definitions ''per se''. or ; Term : Description Line 1 : Description Line 2 |
Definition (description, association) lists:
or
Can be used for more than terms and definitions per se. or
|
* Or create mixed lists *# and nest them *#* like this. *#*; Fruits *#*: Apple *#*: Blueberry |
|
# A line break in an item is done with HTML<br />like this. # Just breaking the line will accidentally end the list like this. # This was supposed to be item 3, not a new list. |
like this.
|
* A new paragraph in an item is also HTML.<p>Like so.</p> * Same goes for<blockquote>"block quotations"</blockquote>like that. * Note that these are done without line-breaking the wikimarkup. |
|
Common mistakes[edit source]
There must not be any blank lines between list items. A blank line terminates a list, and any list entries created afterwards will be considered to be part of a different list. This is most noticeable when using ordered lists and will affect the underlying HTML code, which may cause issues with some screen readers.
You type | You get |
---|---|
# This is the first item. # This is the second item. # This is the third item. # This is the fourth item. |
|
# This is the first item. # This is the second item. # This is the third item. # This is the fourth item. |
|
In order to be a list, each line must begin the same way. Starting a line differently will cause it to be interpreted as a different list. This also affects the underlying HTML and may also cause issues with screen readers.
You type | You get |
---|---|
# If you start with # one type of list, #; and then a sublist #: of a different type, #:* the list characters # always go in order. |
|
# If you reverse # the order, ;# everything :# gets *:# thrown off # and nothing matches up. |
|
Don't use a semicolon to simply give a list (or anything else, for that matter) a title. Semicolons and colons make up one kind of list; asterisks and number signs make another. This will (again) affect the underlying HTML and causes issues with screen readers.
You type | You get |
---|---|
;Never do *this |
|
Paragraphs and other breaks[edit source]
For simplicity, lists in wiki markup can't be longer than a paragraph. A single line break will end the list entry, and the entire list will be ended if the line doesn't start with the same character as the list. This is most noticeable with ordered lists, where the numbering will get reset if this happens. For unordered lists, the effect may not appear to be noticeable on-screen, but it will cause issues with screen readers and is bad for accessibility.
The best way to create paragraphs inside list items is to use the <p> ... </p>
HTML tags, with no line breaks in the wiki markup.
You type | You get |
---|---|
# Paragraph 1.<p>Paragraph 2.</p><p>Paragraph 3.</p> # Second item. |
|
# Do not <p>Do this</p> <p>It will</p> # Not work |
Do this It will
|
If it would be useful to have line breaks, in the wiki markup of the page, such as if the paragraphs are very long, you can use HTML comments to accomplish this. The comments must start at the end of one line and end at the start of another.
You type | You get |
---|---|
# Paragraph 1.<!-- --><p>Paragraph 2.</p><!-- --><p>Paragraph 3.</p> # Second item. |
|
For a single line break, you can use a single <br />
tag. This is useful where nested lists are not desired.
You type | You get |
---|---|
# Get ingredients:<br />1 Apple<br />2 Bananas<br />1½ cups of sugar # Add to blender and blend until smooth |
|
You can also add block quotations to lists without breaking them.
You type | You get |
---|---|
* Beginning of first item.<blockquote>A large quotation.</blockquote>Rest of first item.<br /><br /> * Second item. |
|
Continuing a list item after a sub-item[edit source]
In HTML, a list item may contain several sublists, not necessarily adjacent; thus there may be parts of the list item not only before the first sublist, but also between sublists, and after the last one. However, in wiki markup, sublists follow the same rules as sections of a page: the only possible part of the list item not in sublists is before the first sublist.
In the case of an unnumbered first-level list in wikitext code this limitation can be overcome by splitting the list into multiple lists. Indented text between the partial lists may visually serve as part of a list item after a sublist. However, this may give, depending on CSS, a blank line before and after each list, in which case, for uniformity, every first-level list item could be made a separate list.
Numbered lists illustrate that what should look like one list may, for the software, consist of multiple lists; unnumbered lists give a corresponding result, except that the problem of restarting with 1 is not applicable.
You type | You get |
---|---|
<ol> <li>list item A1 <ol> <li>list item B1</li> <li>list item B2</li> </ol>continuing list item A1 </li> <li>list item A2</li> </ol> |
|
vs. | |
#list item A1 ##list item B1 ##list item B2 #:continuing list item A1 #list item A2 |
|
Going one level deeper, with a sublist item continuing after a sub-sublist, will produce even more blank lines; however, the continuation of the first-level list is not affected:
You type | You get |
---|---|
# list item A1 ## list item B1 ### list item C1 ##: continuing list item B1 ## list item B2 # list item A2 |
|
Changing the list type[edit source]
The list type determines what kind of marker is used before the list item. It can be changed using the list-style-type CSS property.
You type | You get |
---|---|
<ol style="list-style-type:lower-roman"> <li>About the author</li> <li>Foreword to the first edition</li> <li>Foreword to the second edition</li> </ol> |
|
<ol style="list-style-type:lower-alpha"> <li>About the author</li> <li>Foreword to the first edition</li> <li>Foreword to the second edition</li> </ol> |
|
Extra indentation of lists[edit source]
Lists are indented by 3.2em by default. In a numbered list in a large font, some browsers do not show more than two digits of indentation unless extra indentation is applied (if there are multiple columns, for each column). This can be fixed by increasing the indentation an additional 2em.
The easiest way to do this is to add <ol> ... </ol>
or <ul> ... </ul>
tags around wiki markup list items. The parser translates a list without any list items into a <div style="margin-left: 2em;"
, which causes indentation. This is good for most cases, but it doesn't allow you to start an ordered list with a number other than 1.
You type | You get |
---|---|
<ol> # abc # def # ghi </ol> |
|
<ul> #abc #def #ghi </ul> |
|
The best way to create an indented list is to use full HTML instead of wiki markup. Although not the easiest, it works well for both basic and complex lists; doesn't produce invalid HTML; and allows ordered lists to start with a number other than 1.
You type | You get |
---|---|
<ol style="margin-left: 5.2em;"> <li>abc</li> <li>def</li> <li>ghi</li> </ol> |
|
Avoid using definition lists for indenting other lists. This technique works in a hurry, but produces poorly formed HTML and causes accessibility issues.
You type | You get |
---|---|
:# abc :# def :# ghi |
|
Specifying a starting value[edit source]
You can have an ordered list start on a different number other than 1. This can be accomplished using HTML. Only the list item whose value is being changed needs to use HTML; the rest can use regular wiki markup.
You type | You get |
---|---|
# <li value="9">Amsterdam</li> # Rotterdam # The Hague |
|
Alternatively, you can use all HTML for the list.
You type | You get |
---|---|
<ol start="9"> <li>Amsterdam</li> <li>Rotterdam</li> <li>The Hague</li> </ol> |
|
<ol> <li value="9">Amsterdam</li> <li value="8">Rotterdam</li> <li value="7">The Hague</li> </ol> |
|
Multi-column lists[edit source]
You can use the {{Columns-list}} to add columns to a list.
You type | You get |
---|---|
{{columns-list|colwidth=10em| * apple * carpet * geography * mountain * nowhere * postage * ragged * toast }} |
|
{{columns-list|colwidth=10em| # apple # carpet # geography # mountain # nowhere # postage # ragged # toast }} |
|
This is the general solution. Other solutions that also work include using the {{Col-begin}}, {{Col-break}}, and {{Col-end}} templates...
You type | You get | ||
---|---|---|---|
{{Col-begin}} {{Col-break}} * apple * carpet * geography * mountain {{Col-break}} * nowhere * postage * ragged * toast {{Col-end}} |
| ||
...or using HTML.
You type | You get |
---|---|
<div style="column-count:2;-moz-column-count:2;-webkit-column-count:2"> * apple * carpet * geography * mountain * nowhere * postage * ragged * toast </div> |
|
<div style="column-count:3;-moz-column-count:3;-webkit-column-count:3"> * apple * carpet * geography * mountain * nowhere * postage * ragged * toast </div> |
|
Tables[edit source]
A one-column table is very similar to a list, but it allows sorting. If the wiki markup itself is already sorted with the same sortkey, this advantage does not apply. A multiple-column table allows sorting on any column.
You type | You get | ||||||
---|---|---|---|---|---|---|---|
{| |Apple |- |Orange |- |Bread |- |Butter |- |Ice cream |} |
| ||||||
{| class="wikitable sortable" |- ! Groceries |- |Apple |- |Orange |- |Bread |- |Butter |- |Ice cream |} |
| ||||||
See also[edit source]
- Help:List on English Wikipedia
- Help:Lists on MediaWiki.org