Toothpick Anemone
Toothpick Anemone

Reputation: 4644

What are three example of tables written using WikiText Mark-up Language without any Additional Documentation?

Suppose that we wanted to create a table on a website like Wikipedia

What source code would produce a table such as the one shown below?:

Fruit NonFruitVegetable
CucumberFruit SpinachLeavesandStems
TomatoFruit SpinachLeavesandStems
ZucchiniFruit CeleryLeavesandStems
AppleFruit PotatoRoot
OrangeFruit OnionRoot
CarrotRoots

A correct answer to this question would an example of valid source code for a table.

We don't want pages and pages of documentation or explanation, just working functional code.

The following code is incorrect and contains some mistakes:

{| class="wikitable"
  |+ Title Goes Here.
|-
  ! Fruit
  ! NonFruitVegetable
|-
  | CucumberFruit
  | TomatoFruit
  | ZucchiniFruit
  | AppleFruit
  | OrangeFruit
|-
  | SpinachLeavesandStems 
  | CeleryLeavesandStems
  | PotatoRoot
  | OnionRoot
  | CarrotRoots 
|}

a screen capture of what the invalid code produces when rendered on wikipedia

Upvotes: -3

Views: 57

Answers (1)

InSync
InSync

Reputation: 10437

As you wish:

{| class="wikitable"
|+ Title Goes Here.
|-
! Fruit
! NonFruitVegetable
|-
| CucumberFruit
| SpinachLeavesandStems
|-
| TomatoFruit
| SpinachLeavesandStems
|-
| ZucchiniFruit
| CeleryLeavesandStems
|-
| AppleFruit
| PotatoRoot
|-
| OrangeFruit
| OnionRoot
|-
|
| CarrotRoots
|}

Try it on mediawiki.org.

Explanation (just skip it if you don't want to read):

Wikitext HTML equivalence (roughly)
{|/|} <table></table>
{| class="wikitable" <table class="wikitable">
|+ <caption></caption>
|+ Foobar <caption>Foobar</caption>
|- <tr></tr>
|- class="row" <tr class="row"></tr>
| <td></td>
| rowspan="2" <td rowspan="2"></td>

Reference: Help:Tables - mediawiki.org

Upvotes: 1

Related Questions