Side Thoughts: Promoting pipe tables as a potential alternative to .CSV format (e.g. .PSV ?)

I’m preparing a document that describes my ideas for PSV in more detail.

Table bodies and foots

HTML supports mutliple <tbody> elements per table and also an optional <tfoot>, while GFM pipe tables support a mandatory <thead> and no or one <tbody>. These are row-groups, of course, and the CSS display value is the same for all f them. I see 5 major variants to improve on this, most of which have two sub-variants. GFM is a subset of variant 1, I prefer 3b which is a superset of 1.

               ------              ======                                  ====== 
 Head           Head                Head                Head                Head
------         ------              ------              ======              ====== 
 Body           Body                Body                Body                Body   
------         ------              ------              ======              ======  
 Foot           Foot                Foot                Foot                Foot 
               ------              ======                                  ======

^^^^^^    ^^^^^^^^^^^^^^^^    ^^^^^^^^^^^^^^^^    ^^^^^^^^^^^^^^^^    ^^^^^^^^^^^^^^^^

          ------    ------    ======    ======                        ======    ======
 Head      Head      Head      Head      Head      Head      Head      Head      Head 
------    ------    ------    ------    ------    ======    ======    ======    ======
 Body      Body      Body      Body      Body      Body      Body      Body      Body 
------              ------              ------    ------    ======    ------    ======
 Body      Body      Body      Body      Body      Body      Body      Body      Body 
------    ------    ------    ------    ------    ======    ======    ======    ======  
 Foot      Foot      Foot      Foot      Foot      Foot      Foot      Foot      Foot 
          ------    ------    ======    ======                        ======    ======

  1         2a        2b        3a        3b        4a        4b        5a        5b

Block content, line spanning

I think I’ve cracked row spans for GFM pipe tables, but am not completely sure how to do column spans yet. The general idea for rowspan is to fill all cells that do not continue from the row above with dashes.

I think I’ve cracked block contents for GFM pipe tables, but am not sure how to do row and column spans yet. The general idea is to fill all cells that do not continue from the row above with dashes.

|  head  |  head  |
| ------ | ------ |
| 1. one | cell   |
| 2. two | ------ |
| cell   | cell   |
| cell   | 1. one |
| ------ | 2. two |
| ------ | 3. end |
.
<table>
<thead>
<tr><th>head</th><th>head</th></tr>
</thead>
<tbody>
<tr><td><ol><li>one</li><li>two</li></ol></td><td>cell</td></tr>
<tr><td>cell</td><td>cell</td></tr>
<tr><td>cell</td><td><ol><li>one</li><li>two</li><li>end</li></ol></td></tr>
</tbody>
</table>
head head
  1. one
  2. two
cell
cell
  1. one
  2. two
cell cell

If you do not have any single-line cell in a row you would need to add another bogus one. The simplest GFM-conformat solution is simply appending a dash at the end of all lines.

|  head  |  head  |-
| ------ | ------ |-
| 1. one | 1. one |-
| 2. two | 2. two |-
| ------ | 3. end |-
.
<table>
<thead>
<tr><th>head</th><th>head</th></tr>
</thead>
<tbody>
<tr>
<td><ol><li>one</li><li>two</li></ol></td>
<td><ol><li>one</li><li>two</li><li>end</li></ol></td>
</tr>
</tbody>
</table>
head head
  1. one
  2. two
  1. one
  2. two
  3. end

Without the empty column at the end, which should be ignored on output, the parsing would be different.

|  head  |  head  |
| ------ | ------ |
| 1. one | 1. one |
| 2. two | 2. two |
| ------ | 3. end |
.
<table>
<thead>
<tr><th>head</th><th>head</th></tr>
</thead>
<tbody>
<tr><td>1. one</td><td>1. one</td></tr>
<tr><td><ol><li>two</li></ol></td><td><ol><li>two</li><li>end</li></ol></td></tr>
</tbody>
</table>
head head
1. one 1. one
  1. two
  1. two
  2. end

The problem with this approach is that a parser may have to look at many rows in advance to determine whether there is a valid block context.

1 Like