Next: , Up: Mk 6 Application Data Formatter

7.1 Format Specification Syntax

A format specification is composed of zero or more directives: ordinary characters (not %), which are copied unchanged to whatever output, and special directives introduced by the character %, which are converted before printing on the same whatever output.

Apart from the reqular, data (find(1) like) format directives some special directives (call them subformat specifiers) are interpreted.

A subformat specifier is composed of the introducing character % followed by the literal sign identifying the subformat specifier and a subformat specification enclosed in parentheses.

Optionally, a range specification (allowing for list elements selection) may immediately preced the literal sign identifying the subformat specifier.

If no range was specified and the application hasn't specifically disallowed, a second subformat specification enclosed in parentheses may follow.

A subformat specifier does not specify by itself any output but only allows for more flexible formatting and iterative (its format specification is run as many times the application limited user specified range rules) or conditional output (its first subformat specification is printed if some conditions set is met, the second, if any, otherwise).

See Conditional Formatting.

See Iterative Formatting.

A subformat specifier does replace the current set of interpreted directives with its own set within its scope (the first subformat specification).

A special subformat specifier is the spacing subformat specifier, which is composed of the introducing character % followed immediately by the subformat specification enclosed in parentheses (the identifying literal sign is missing). Its subformat specification is always printed and it does not replace the set of interpreted directives.

After the introducing %, the following may appear in sequence:

The opening and closing parentheses must be escaped when not marking the begin and end of a subformat specification.

The range for the directive introducing literal signs is limited to letters.

The (iterative output) range (possibly selecting list elements) immediately following the formatting directive introducing % (`percent') sign is specified as a list of indeces and from to pairs separated by one , (`comma') sign. The from to pair syntax requires a - (`hyphen') sign in between the from and to specifications.