From 71a57942af1610d801c873e829de01dc3eff12f2 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 07 Feb 2019 11:37:20 -0500 Subject: [PATCH] Allow continuation of table cells on the next line --- scdoc.5.scd | 11 +++++++---- src/main.c | 3 +++ diff --git a/scdoc.5.scd b/scdoc.5.scd index 1720ffc0f5d25b9e487fb06f8a3a832aeadd981d..65a2b3661042fc89138c65950a60ce85ce5823fd 100644 --- a/scdoc.5.scd +++ b/scdoc.5.scd @@ -118,10 +118,11 @@ To begin a table, add an empty line followed by any number of rows. Each line of a table should start with | or : to start a new row or column -respectively, followed by [ or - or ] to align the contents to the left, center, -or right, followed by a space and the contents of that cell. You may use a -space instead of an alignment specifier to inherit the alignment of the same -column in the previous row. +respectively (or space to continue the previous cell on multiple lines), +followed by [ or - or ] to align the contents to the left, center, or right, +followed by a space and the contents of that cell. You may use a space instead +of an alignment specifier to inherit the alignment of the same column in the +previous row. The first character of the first row is not limited to | and has special meaning. [ will produce a table with borders around each cell. | will produce a @@ -140,6 +141,7 @@ :] world! | *Row 2* : こんにちは : 世界 + ! ``` [[ *Foo* @@ -151,6 +153,7 @@ :] world! | *Row 2* : こんにちは : 世界 + ! ## LITERAL TEXT diff --git a/src/main.c b/src/main.c index a012e3b8450b49a713aa03ce8cd870cda23883c5..930cbca148d39e39f71493a70910fd4251f828b6 100644 --- a/src/main.c +++ b/src/main.c @@ -481,6 +481,8 @@ } ++column; } break; + case ' ': + goto continue_cell; default: parser_fatal(p, "Expected either '|' or ':'"); break; @@ -516,6 +518,7 @@ parser_fatal(p, "Expected one of '[', '-', ']', or ' '"); break; } curcell->contents = str_create(); +continue_cell: switch (ch = parser_getch(p)) { case ' ': // Read out remainder of the text -- 2.48.1