Next: , Previous: , Up: Highlighting parts of PO files   [Contents][Index]


9.11.4 Style rules for PO files

The same style file can be used for styling of a PO file, for terminal output and for HTML output. It is written in CSS (Cascading Style Sheet) syntax. See https://www.w3.org/TR/css2/cover.html for a formal definition of CSS. Many HTML authoring tutorials also contain explanations of CSS.

In the case of HTML output, the style file is embedded in the HTML output. In the case of text output, the style file is interpreted by the msgcat program. This means, in particular, that when @import is used with relative file names, the file names are

CSS rules are built up from selectors and declarations. The declarations specify graphical properties; the selectors specify when they apply.

In PO files, the following simple selectors (based on "CSS classes", see the CSS2 spec, section 5.8.3) are supported.

These selectors can be combined to hierarchical selectors. For example,

.msgstr .invalid-format-directive { color: red; }

will highlight the invalid format directives in the translated strings.

In text mode, pseudo-classes (CSS2 spec, section 5.11) and pseudo-elements (CSS2 spec, section 5.12) are not supported.

The declarations in HTML mode are not limited; any graphical attribute supported by the browsers can be used.

The declarations in text mode are limited to the following properties. Other properties will be silently ignored.

color (CSS2 spec, section 14.1)
background-color (CSS2 spec, section 14.2.1)

These properties is supported. Colors will be adjusted to match the terminal’s capabilities. Note that many terminals support only 8 colors.

font-weight (CSS2 spec, section 15.2.3)

This property is supported, but most terminals can only render two different weights: normal and bold. Values >= 600 are rendered as bold.

font-style (CSS2 spec, section 15.2.3)

This property is supported. The values italic and oblique are rendered the same way.

text-decoration (CSS2 spec, section 16.3.1)

This property is supported, limited to the values none and underline.


Next: Customizing less for viewing PO files, Previous: The --style option, Up: Highlighting parts of PO files   [Contents][Index]