Skip to content

Commit

Permalink
Update specs
Browse files Browse the repository at this point in the history
  • Loading branch information
xoofx committed Feb 27, 2023
1 parent 0a16724 commit 8155a1e
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions src/Markdig.Tests/Specs/GridTableSpecs.generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public class TestExtensionsGridTable
//
// ## Grid Table
//
// A grid table allows to have multiple lines per cells and allows to span cells over multiple columns. The following shows a simple grid table
// A grid table allows having multiple lines per cells and allows spanning cells over multiple columns.
// The following shows a simple grid table:
//
// ```
// +---------+---------+
Expand All @@ -38,17 +39,20 @@ public class TestExtensionsGridTable
// ```
//
// **Rule #1**
// The first line of a grid table must a **row separator**. It must start with the column separator character `+` used to separate columns in a row separator. Each column separator is:
// - starting by optional spaces
// - followed by an optional `:` to specify left align, followed by optional spaces
// - followed by a sequence of at least one `-` character, followed by optional spaces
// - followed by an optional `:` to specify right align (or center align if left align is also defined)
// - ending by optional spaces
// The first line of a grid table must be a **row separator**.
// It must start with the column separator character `+` used to separate columns in a row separator.
//
// The first row separator must be followed by a *regular row*. A regular row must start with the character `|` that is starting at the same position than the column separator `+` of the first row separator.
// Each column separator:
// - starts with optional spaces
// - followed by an optional `:` to specify left align, followed by optional spaces
// - followed by a sequence of one or more `-` characters, followed by optional spaces
// - followed by an optional `:` to specify right align (or center align if left align is also defined)
// - ends with optional spaces
//
// The first row separator must be followed by a *regular row*.
// A regular row must start with a `|` character starting at the same position as the column separator `+` of the first row separator.
//
// The following is a valid row separator
// The following is a valid row separator:
[Test]
public void ExtensionsGridTable_Example001()
{
Expand All @@ -74,7 +78,7 @@ public void ExtensionsGridTable_Example001()
TestParser.TestSpec("+---------+---------+\n| This is | a table |", "<table>\n<col style=\"width:50%\" />\n<col style=\"width:50%\" />\n<tbody>\n<tr>\n<td>This is</td>\n<td>a table</td>\n</tr>\n</tbody>\n</table>", "gridtables|advanced", context: "Example 1\nSection Extensions / Grid Table\n");
}

// The following is not a valid row separator
// The following is not a valid row separator:
[Test]
public void ExtensionsGridTable_Example002()
{
Expand All @@ -93,7 +97,8 @@ public void ExtensionsGridTable_Example002()
}

// **Rule #2**
// A regular row can continue a previous regular row when column separator `|` are positioned at the same position than the previous line. If they are positioned at the same location, the column may span over multiple columns:
// A regular row can continue a previous regular row when the column separators `|` are positioned at the same position as those of the previous line.
// If they are positioned at the same location, the column may span over multiple columns:
[Test]
public void ExtensionsGridTable_Example003()
{
Expand Down Expand Up @@ -187,15 +192,13 @@ public void ExtensionsGridTable_Example005()
TestParser.TestSpec("+---------+---------+\n| This is | a table with a longer text in the second column", "<table>\n<col style=\"width:50%\" />\n<col style=\"width:50%\" />\n<tbody>\n<tr>\n<td>This is</td>\n<td>a table with a longer text in the second column</td>\n</tr>\n</tbody>\n</table>", "gridtables|advanced", context: "Example 5\nSection Extensions / Grid Table\n");
}

// The respective width of the columns are calculated from the ratio between the total size of the first table row without counting the `+`: `+----+--------+----+` would be divided between:
// The respective widths of the columns are calculated from the ratio between the total size of the first table row without counting the `+`: `+----+--------+----+` would be divided between:
//
// Total size is : 16
// - `----` → 4 characters
// - `--------` → 8 characters
// - `----` → 4 characters
//
// - `----` -> 4
// - `--------` -> 8
// - `----` -> 4
//
// So the width would be 4/16 = 25%, 8/16 = 50%, 4/16 = 25%
// The total size is 16 characters, so the widths would be 4/16 = 25%, 8/16 = 50%, and 4/16 = 25%.
[Test]
public void ExtensionsGridTable_Example006()
{
Expand Down Expand Up @@ -296,7 +299,7 @@ public void ExtensionsGridTable_Example008()
TestParser.TestSpec("+---+---+---+\n| AAAAA | B |\n+---+---+ B +\n| D | E | B |\n+ D +---+---+\n| D | CCCCC |\n+---+---+---+", "<table>\n<col style=\"width:33.33%\" />\n<col style=\"width:33.33%\" />\n<col style=\"width:33.33%\" />\n<tbody>\n<tr>\n<td colspan=\"2\">AAAAA</td>\n<td rowspan=\"2\">B\nB\nB</td>\n</tr>\n<tr>\n<td rowspan=\"2\">D\nD\nD</td>\n<td>E</td>\n</tr>\n<tr>\n<td colspan=\"2\">CCCCC</td>\n</tr>\n</tbody>\n</table>", "gridtables|advanced", context: "Example 8\nSection Extensions / Grid Table\n");
}

// A grid table may have cells with both colspan and rowspan:
// A grid table may have cells with both `colspan` and `rowspan`:
[Test]
public void ExtensionsGridTable_Example009()
{
Expand Down

0 comments on commit 8155a1e

Please sign in to comment.