Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Create table within a table in a wiki page

Tags:

wiki

mediawiki

I want to create the following table within a table in a wiki page:

A  :  B           (Line 1)
C  :  D
E  :  F1    G1    (Line 3)
      F2    G2
      F3    G3
H  :  I

One option is to create the main table with four columns. That would mean creating empty string for col 3, 4 for lines 1 (and similar ones). Is there

{|
 |A
 |:
 |B
 |
 |
 |-
 (etc)
|}

I was wondering if there is a way to state that I want to create an embedded table for Row 3 / Col 3 element of the main table?

I tried the following:

{|
{|
 |A
 |:
 |B
 |-
 |C
 |:
 |D
 |-
 |E
 |:
 {|
 |F1
 |G1
 |-
 |F2
 |G2
 |-
 |F3
 |G3
 |}
 |-
 |H
 |:
 |I
|}

However the above did not work, "B", and "D" got indented to the right of the "F/G" table.

Any ideas?

Kind of related question, how do I escape characters single characters like "{" and "|" so they get displayed.

like image 716
Ahmed A Avatar asked Oct 11 '25 07:10

Ahmed A


1 Answers

Embedding one table inside another should not be a problem. In your code there is a table cell missing after the nested table, that could maybe mess things upp in some browsers. The follwing works well in every browser I try:

{| border="1"
 |A
 |:
 |B
 |-
 |C
 |:
 |D
 |-
 |E
 |:
   {|
    |F1
    |G1
    |-
    |F2
    |G2
    |-
    |F3
    |G3
    |}
 |
 |-
 |H
 |:
 |I
|}

to use special characters such as pipe in MediaWiki wiki code, the easiest way (and less confusing for other editors) is to include it in <nowiki> code:

<nowiki> { | } </nowiki> 

On a related note: Problems do arise when you start using parser functions inside tables, as the pipe character then have a special meaning. The most common solution to this problem (frequently used on Wikipedia,for instance), is to create a template (usually called Template:!, as ! visually resembles |), containing only the single character |. You can then use {{!}} as a substitute for | inside not only tables, but also template variables.

like image 88
leo Avatar answered Oct 14 '25 06:10

leo