Using Lists and Tables with MediaWiki

0
152
6 min read

Using Lists with MediaWiki

The three types of lists available in HTML—unordered lists, ordered lists, and definition lists—are also available in MediaWiki. In MediaWiki, we can use both HTML and wiki syntax for creating lists. We will explore both techniques in this article.

Unordered List

Creating unordered lists in MediaWiki is very simple. In order to create an unordered list in MediaWiki using wiki syntax, keep the following rules in mind:

  • Use the asterisk (*) sign at the beginning of each line for creating a list element. The number of asterisks you add before the line will indicate the level of list element in the unordered list. For example, ** will indicate a second-level list element, while *** will indicate a third-level list element, and so on.
  • In order to restart an unordered list, put a wiki line break (an empty line) at the end of the list. Then you can start another list using *.

Let’s open a new page and write the following content in order to create an unordered list:

* Ghost Directory - North America:
** United States of America.
*** Florida.
*** New York.
**** Long Island
**** Manhattan
**** Cooney Island
*** New Jersey
*** Michigan
* Ghost Directory - Europe:
** United Kingdom
*** Liverpool
*** Fulham
** Ireland
** Finland
** Sweden
Other directories.
* Bangladesh
* India.

Now let’s click on Save page to see the unordered lists that we have created:

Using Lists and Tables with MediaWiki

Now let us see how to create the same list using HTML syntax:

<ul><li>Ghost Directory - North America :
   <ul><li>United States of America.
      <ul><li> Florida.
            <li> New York.
            <ul><li>Long Island
                   <li>Manhattan
                   <li>Cooney Island
            </ul>
            <li> New Jersey
            <li> Michigan
      </ul>
   </ul>
</ul>
<ul><li> Ghost Directory - Europe:
      <ul><li> United Kingdom
            <ul><li>Liverpool
                   <li>Fulham
            </ul>
       <li>Ireland
<li>Finland
<li>Sweden
</ul>
</ul>
Other directories.
<ul><li> Bangladesh
<li> India.
</ul>

From the previous two examples we see that the wiki syntax definitely gives us a less hard time generating the unordered list.

Ordered List

The basic difference between unordered and ordered lists is that while we see only bullets for unordered lists, in an ordered list we will see numbers like 1,2… etc. In order to create an ordered list in MediaWiki using wiki syntax, keep the following rules in mind:

  • Use the hash (#) sign for creating each list element. The number of hashes you add before the line will indicate the level of list element in the ordered list. For example, ## will indicate a second-level list element, ### will indicate a third-level list element, and so on.
  • In order to restart an ordered list, put a blank line at the end of the list. Then you can then start another list using #.

Now look at the following example in MediaWiki to create an ordered list:

In order to submit your story for the Monthly Haunted story contest, you have to follow the 
guidelines below:
Stories can have the following Categories
# Novel
# Short Story
# Real life story
# Articles
Here are the writing guidelines
# Basic Guidelines
## Story must be within 1200 words.
## Computer Typed:
### Font size: 12 pt
### Paragraph: double line break
### Font Name: Times New Roman
## Well formatted with a front page
## Front page content:
### Story name
### Author Name
### Submission Date
### Category
### Author Email Address
# All entries must be submitted before 1st October, 2006
# For any query, contact storyteller@haunted.com

Click on Save page to see the ordered list, which appears as shown below:

Using Lists and Tables with MediaWiki

Now if the same example is created with HTML tags, we will see that the wiki syntax is much easier to apply than HTML syntax.

However, there still are some places where we have to use HTML instead of wiki syntax. Take this example: we have a list of ghost sighting for the last 100 years starting from early 1900s. We want to show the sightings sequentially using the years rather than 1, 2, 3, etc. In MediaWiki all ordered lists start from 1, and we cannot define any attribute for wiki syntax. Hence it is not possible for us to start with predefined numbering. Maybe future MediaWiki versions will have something to accommodate this feature.

So let’s see how we can perform the task with HTML:

Here is the list of ghost sightings in the last 100 years
<ol start=1905>
<li> Ghosts Sighted in Year 1905
<ol><li>3rd January: Ghost of ancient Mariner sighted at Port City,
Florida, USA
<li>10th January: Ghost of a Little girl sighted at a village
in Ireland
<li>5th May: A werewolf sighted in a mountain region of
Colorado.
<li>25th December: A Christmas ghost sighted in Texas
</ol>
<li> Ghosts Sighted in Year 1906
<ol><li> 3 sightings have been reported but details about place and
time are not available.
</ol>
<li> Ghosts Sighted in Year 1907
<ol><li>3rd January: Ghost of ancient Mariner sighted again after
2 years at Port City, Florida, USA
<li>11th June: Ghost of a Mathematician sighted at an old
valley, Texas
</ol>
</ol>
<ol start=1937>
<li> Ghosts Sighted in Year 1937
<ol><li>January, First Vampire existence found in United Kingdom
<li>April, A sailor ghost was sighted on a ship bound to
USA from UK
<li> July, The sailor ghost again sighted on a ship bound to
USA from UK - it was named Atlantic Nightmare.
</ol>
</ol>

Click on Save page to see the output as shown in the following screenshot:

Using Lists and Tables with MediaWiki

So, from the previous example, we see that it’s better to use HTML tags in special cases, where wiki syntax is not of much help. This is the reason why MediaWiki allows the use of HTML tags for formatting.


LEAVE A REPLY

Please enter your comment!
Please enter your name here