Previous: , Up: Library Files   [Contents][Index]


5.4 Style Sheet Files

The style sheets are defined in various files (see Pretty Printing for the structure of these files). As for most other features, there is main file, a road map, which defines in which condition a style sheet should be used (see Map Files). This file is sheets.map.

Its format is simple:

style-key: patterns

or

include(file)

The patterns need not be on separate lines. There are two kinds of patterns:

/pattern/flags

if the current file name matches pattern, then select style style-key (i.e. file style-key.ssh).

<pattern>flags

if the result of a call to file(1) matches pattern, then select style style-key.

Currently flags can only be ‘i’, standing for an insentive match. Please note that the matching is not truly case insensitive: rather, a lower case version of the string is compared to the pattern as is, i.e., the pattern should itself be lower case.

The special style-keybinary’ tells a2ps to consider that the file should not be printed, and will be ignored, unless option ‘--print-anyway’ is given.

If a style name can’t be found, the plain style is used.

The map file is read bottom up, so that the “last” match is honored.

Two things are to retain from this:

  1. if the file is presented through stdin, then a2ps will run file(1). However, unless you specify a fake file name with ‘--stdin’, pattern matching upon the name is turn off. In general you can expect correct delegations, but almost never pretty printing.
  2. if file is wrong on some files, a2ps may use bad style sheets. In this case, do try option ‘--guess’, compare it with the output of file, and if the culprit is file, go and complain to your system administrator :-), or fix it by defining your own filename pattern matching rules.

Consider the case of Texinfo files as an example (the language in which this documentation is written). Files are usually named foo.texi, bar.txi, or even baz.texinfo. file(1) is able to recognize Texinfo files:

doc % file a2ps.texi
a2ps.texi: Texinfo source text

Therefore the sheets.map would look like:

# Texinfo files
texinfo:  /*.txi/  /*.texi/  /*.texinfo/
          <Texinfo source*>

Previous: Font Files, Up: Library Files   [Contents][Index]