Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Rackham S.AsciiDoc user guide Rev7.1.2.2006.pdf
Скачиваний:
18
Добавлен:
23.08.2013
Размер:
298.24 Кб
Скачать

AsciiDoc User Guide

A B C D

A table with a numeric ruler and externally sourced CSV data:

[frame="all", grid="all"]

.15`20`25`20`~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ID,Customer Name,Contact Name,Customer Address,Phone

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

include::customers.csv[]

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Renders:

ID

Customer

Contact Name

Customer

Phone

 

Name

 

Address

 

 

 

 

 

 

AROUT

Around the

Thomas Hardy

120 Hanover

(171)

 

Horn

 

Sq. London

555-7788

 

 

 

 

 

BERGS

Berglunds

Christina

Berguvsvagen

0921-12 34 65

 

snabbkop

Berglund

8 Lulea

 

 

 

 

 

 

BLAUS

Blauer See

Hanna Moos

Forsterstr. 57

0621-08460

 

Delikatessen

 

Mannheim

 

 

 

 

 

 

BLONP

Blondel pere

Frederique

24, place

88.60.15.31

 

et fils

Citeaux

Kleber

 

 

 

 

Strasbourg

 

 

 

 

 

 

BOLID

Bolido

Martin Sommer

C/ Araquil, 67

(91) 555 22 82

 

Comidas

 

Madrid

 

 

preparadas

 

 

 

 

 

 

 

 

BONAP

Bon app'

Laurence Lebihan

12, rue des

91.24.45.40

 

 

 

Bouchers

 

 

 

 

Marseille

 

 

 

 

 

 

BOTTM

Bottom-Dollar

Elizabeth Lincoln

23 Tsawassen

(604)

 

Markets

 

Blvd.

555-4729

 

 

 

Tsawassen

 

 

 

 

 

 

BSBEV

B's Beverages

Victoria Ashworth

Fauntleroy

(171)

 

 

 

Circus

555-1212

 

 

 

London

 

 

 

 

 

 

CACTU

Cactus

Patricio Simpson

Cerrito 333

(1) 135-5555

 

Comidas para

 

Buenos Aires

 

 

llevar

 

 

 

 

 

 

 

 

AsciiDoc Table Block Elements

This sub-section details the AsciiDoc table format.

Table

::= (Ruler,Header?,Body,Footer?)

Header

::= (Row+,Underline)

Footer

::= (Row+,Underline)

Body

::=

(Row+,Underline)

Row

::=

(Data+)

42

AsciiDoc User Guide

A table is terminated when the table underline is followed by a blank line or an end of file. Table underlines which separate table headers, bodies and footers should not be followed by a blank line.

Ruler

The first line of the table is called the Ruler. The Ruler specifies which configuration file table definition to use, column widths, column alignments and the overall table width.

There are two ruler formats:

Character ruler

The column widths are determined by the number of table fill characters between column stop characters.

Numeric ruler

The column widths are specified numerically. If a column width is omitted the previous width is used. In the degenerate case of no widths being specified columns are allocated equal widths.

The ruler format can be summarized as:

ruler ::= ((colstop,(colwidth,fillchar+)?)+, fillchar+, tablewidth?

The ruler starts with a column stop character (designating the start of the first column).

Column stop characters specify the start and alignment of each column:

Backtick (`) — align left.

Single quote (') — align right.

Period (.) — align center.

In the case of fixed format tables the ruler column widths specify source row data column boundaries.

The optional tablewidth is a number representing the size of the output table relative to the pagewidth. If tablewidth is less than one then it is interpreted as a fraction of the page width; if it is greater than one then it is interpreted as a percentage of the page width. If tablewidth is not specified then the table occupies the full pagewidth (numeric rulers) or the relative width of the ruler compared to the textwidth (character rulers).

Row and Data Elements

Each table row consists of a line of text containing the same number of Data items as there are columns in the table,

Lines ending in a backslash character are continued on the next line.

Each Data item is an AsciiDoc substitutable string. The substitutions performed are specified by the subs table definition entry. Data cannot contain AsciiDoc block elements.

43

AsciiDoc User Guide

The format of the row is determined by the table definition format value:

fixed

Row data items are assigned by chopping the row up at ruler column width boundaries.

csv

Data items are assigned the parsed CSV (Comma Separated Values) data.

dsv

The DSV (Delimiter Separated Values) format is a common UNIX tabular text file format.

The separator character is a colon (although this can be set to any letter using the separator table attribute).

Common C-style backslash escapes are supported.

Blank lines are skipped.

Underline

A table Underline consists of a line of three or more fillchar characters which are end delimiters for table header, footer and body sections.

Attribute List

The following optional table attributes can be specified in an AttributeList preceding the table:

separator

The default DSV format colon separator can be changed using the separator attribute. For example:

[separator="|"].

frame

Defines the table border and can take the following values: topbot (top and bottom), all (all sides), none and sides (left and right sides). The default value is topbot.

grid

Defines which ruler lines are drawn between table rows and columns. The grid attribute value can be any of the following values: none, cols, rows and all. The default value is none. For example

[frame="all", grid="none"].

format, tablewidth

See Markup Attributes below.

You can also use an AttributeList to override the following table definition and ruler parameters: format, subs, tablewidth.

Markup Attributes

The following attributes are automatically available inside table tag and markup templates.

44