Creating Nested Tables

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Creating Nested Tables

mariocup
Hello,

I recently found at the mrhaki blog post a documentation how to create nested tables in Asciidoctor. I suggest to add this information in the user manual of Asciidoctor.

Defining tables in Asciidoctor is very easy. The start and end of the table are defined by |===. But if we want to add a new table to a table cell we cannot use the same syntax. To define a nested table we must replace the | separator with !. So instead of |=== to indicate the table boundaries we use !===. Also the cell separators are now ! instead of |. Finally we must make sure the table cell or column supports Asciidoc markup, so the table is properly created. We must configure the cell or column with a so the nested table is created.

In the following example Asciidoctor markup we have a simple table with a nested table in the second column and row. Notice we can still apply all table configuration to the nested table as well:

 = Tables
 
== Nested tables
 
To nest a table in a table we must
use `!` as table separator instead of `|`.
Also the type of the column or cell
must be set to `a` so Asciidoc markup
is processed.
 
[cols="1,2a"]
|===
| Col 1 | Col 2
 
| Cell 1.1
| Cell 1.2
 
| Cell 2.1
| Cell 2.2
 
[cols="2,1"]
!===
! Col1 ! Col2
 
! C11
! C12
 
!===
 
|===
Reply | Threaded
Open this post in threaded view
|

Re: Creating Nested Tables

mojavelinux
Administrator
I'm in support of adding documentation for nested tables to the user manual. That topic appears to have been overlooked.

I would want to include with it a recommendation to use this feature sparingly. If you are creating a nested table for anything other than a very specialized use case (such as a reference table), we strongly encourage you to consider a more semantic way of writing the content.

Cheers,

-Dan

On Sat, Jun 17, 2017 at 7:35 AM, mariocup [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hello,

I recently found at the mrhaki blog post a documentation how to create nested tables in Asciidoctor. I suggest to add this information in the user manual of Asciidoctor.

Defining tables in Asciidoctor is very easy. The start and end of the table are defined by |===. But if we want to add a new table to a table cell we cannot use the same syntax. To define a nested table we must replace the | separator with !. So instead of |=== to indicate the table boundaries we use !===. Also the cell separators are now ! instead of |. Finally we must make sure the table cell or column supports Asciidoc markup, so the table is properly created. We must configure the cell or column with a so the nested table is created.

In the following example Asciidoctor markup we have a simple table with a nested table in the second column and row. Notice we can still apply all table configuration to the nested table as well:

 = Tables
 
== Nested tables
 
To nest a table in a table we must
use `!` as table separator instead of `|`.
Also the type of the column or cell
must be set to `a` so Asciidoc markup
is processed.
 
[cols="1,2a"]
|===
| Col 1 | Col 2
 
| Cell 1.1
| Cell 1.2
 
| Cell 2.1
| Cell 2.2
 
[cols="2,1"]
!===
! Col1 ! Col2
 
! C11
! C12
 
!===
 
|===



If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Creating-Nested-Tables-tp5663.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | https://twitter.com/mojavelinux