Default table syntax
a vertical bar and three equal signs ( |=== ) as table row delimiters for beginning and closing.
Each table's column cell is specified by a vertical bar ( | ).
Example:
[cols=2*,separator=¦]
|===
¦The default separator in PSV tables is the \| character.
¦The \| character is often referred to as a "`pipe`".
|===
Result
The default separator in PSV tables is the | character. |
The | character is often referred to as a “pipe”. |
Supported data formats
The default table data format is prefix-separated values (PSV); that means the processor creates a new cell each time it encounters a vertical bar (|
).
AsciiDoc also supports:
- comma-separated values (CSV) (,)
- tab-separated values (TSV)
- delimited data separated values (DSV)
Escape the cell separator
If the cell contains the cell separator, you must escape that character. There are three ways to escape it:
-
Prefix the character with a leading backslash (i.e.,
\|
), which will be removed from the output. -
Use the
{vbar}
attribute reference in place of|
in content. -
Change the cell separator used by the table.
Example of AsciiDoctor CSVTable
[%header,format=csv]
|===
Artist,Track,Genre
Baauer,Harlem Shake,Hip Hop
The Lumineers,Ho Hey,Folk Rock
|===
Result: Rendered CSV table
Artist | Track | Genre |
---|---|---|
Baauer | Harlem Shake | Hip Hop |
The Lumineers | Ho Hey | Folk Rock |
Example
Accessible Table Of AsciiDoctor Sample
.Vegetable prices in Darwin and Hobart[%header, cols=5*]
|===
||Beans|Peas|Carrots|Tomatoes
5+|Darwin
|Wholesale|$1.00|$1.25|$1.20|$1.00
|Retail|$2.00|$3.00|$1.80|$1.60
4+|Hobart
|Wholesale|$1.20|$1.30|$1.00|$0.80
|Retail|$1.60|$2.00|$2.00|$1.50
|===
Result
Beans | Peas | Carrots | Tomatoes | |
---|---|---|---|---|
Darwin | ||||
Wholesale | $1.00 | $1.25 | $1.20 | $1.00 |
Retail | $2.00 | $3.00 | $1.80 | $1.60 |
Hobart | ||||
Wholesale | $1.20 | $1.30 | $1.00 | $0.80 |
Retail | $1.60 | $2.00 | $2.00 | $1.50 |
Tidak ada komentar:
Posting Komentar