PmWiki | Cookbook / Rowspan in simple tables (original) (raw)

Summary: Markup to add a rowspan attribute on a simple table cell

Version: 2018-04-15

Prerequisites: None

Status: Stable

Maintainer: jr

Questions answered by this recipe

All sections are optional, you can remove those that do not apply to your recipe, and add new ones.

  1. How do I specify that a cell spans 2 or more rows in a simple table?
  2. How do I lay out a simple table so that a later editor can see the scope of a rowspan?
  3. How do I lay out a simple table so that a later editor can see the scope of a colspan?

Description

Extend simple table markup to support a rowspan.

Installation

For PmWiki 2.3.37 or newer, the function is enabled by default. To disable it, add to config.php:

$EnableSimpleTableRowspan = 0; # disable rowspan

For PmWiki 2.2.119 to 2.3.36, add to config.php:

$EnableSimpleTableRowspan = 1; # enable rowspan

For PmWiki 2.2.118 or older:

Usage

The markup ||cell text+++ || adds rowspan="3" to the cell. The number of plus signs (+) defines the number of rows spanned. There must be 2 or more plus signs.

The markup ||____|| has the same effect as the markup ||||, 2 or more underscores (_) are required.

The markup ||^^^^|| has the same effect as the markup ||, 2 or more circumflex accents (^) are required.

That's all. It just works.

Notes

Simple tables can be hard to read. The recipe provides 2 simple table markup options with the sole purpose of making the table easier to edit. They have no effect whatsoever on the output. Their usage is entirely optional. Adding or removing them will not change the output.

Make rowspan more visible

| || border=1 | |Spanning rows++ | |Regular text | | | |^^^^^^^^^^^^^^^^^||More text | | | |Plain old text | |Text ends | | | |Spanning rows | |Without using visibility markup ++|| | |First column | | | | --------------------------------------------------------------------------------------------------------------------- | ---------------- | ------------- | - | ----------------------------- | - | --------------- | ---------- | - | -------------- | ------------------------------------- | ------------- | - | | Spanning rowsRegular text More text Plain old textText ends Spanning rowsWithout using visibility markup First column | | | | | | | | | | | | |

Make colspan more visible

| || border=1 | |Spanning columns | |_____________||Regular text | | | |More Regular | |More text | |Still more | | | |Spanning columns | |||Without using visibility markup | | | |____________________||Is this meaningful in the first column? | |No||It's not | | | | Combine both markups to span three columns (''text centered'') | |____________|||| | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- | ----------------------------------------- | - | ------------- | ---------- | ----------- | - | ----------------- | ---------------------------------- | - | ---------------------------------------------------------------------------------- | ------------- | - | ---------------------------------------------------------------- | ----------------------------- | | Spanning columnsRegular text More RegularMore textStill more Spanning columnsWithout using visibility markup Is this meaningful in the first column?NoIt's not Combine both markups to span three columns (text centered) | | | | | | | | | | | | | | | |

Spanning rows and columns

| || border=1 | |Spanning 3 rows and 2 columns+++ | |||Regular text in third and fourth columns|||| | |^^^^^^^^^^^^^^^^||Second row | |Fourth column | | | |Third row | |Fourth column | | | |Spanning rows and columns++ | |||||Fourth column | | | |Without using visibility markup | | | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------- | ----------------------------------------------- | ----------------------------- | -------------- | - | ---------- | -------------- | - | ---------------------------- | ------------------ | - | -------------------------------- | - | | Spanning 3 rows and 2 columnsRegular text in third and fourth columns Second rowFourth column Third rowFourth column Spanning rows and columnsFourth column Without using visibility markup | | | | | | | | | | | | | |

Contributors

Comments

See discussion at RowspanInSimpleTables-Talk

Why doesn't this work

overlapping double rows, two columns

| ||Double row A ++||Column 2 | | | |_____________||Double row B ++|| | |Column 1 | |^^^^^^^^^^^^^|| | | ------------------------------------------ | - | ---------------------------------------------- | --------- | ---------------- | | Double row AColumn 2 Double row B Column 1 | | | | |

but this does?

overlapping double rows, three columns

| ||Double row ++||Column 2||Row one | | | |_____________||Double row ++||Row 2|| | |Column 1 | |^^^^^^^^^^^^^||Row 3|| | | ------------------------------------------------------- | - | --------------------------------------------------- | --------- | ----------------------- | | Double rowColumn 2Row one Double rowRow 2 Column 1Row 3 | | | | |

The browser tries to make all cells the minimum necessary height. When the double row has only 1 line of text, with no third cell to align with, it is as tall as a simple cell. Adding a linebreak in one of the double cells shows that it works as intended.

overlapping double rows, two columns

| ||Double [[<<]]row A ++||Column 2 | | | |_____________||Double row B ++|| | |Column 1 | |^^^^^^^^^^^^^|| | | ------------------------------------------ | - | ---------------------------------------------- | --------- | ---------------- | | Double row AColumn 2 Double row B Column 1 | | | | |

User notes +3: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.