Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter ElevenSGML Functions (continued)

11.3.9 CSS Functions

CSS properties can be accessed directly from an SGML Object as parameters or they can be accessed from mid-level routines that can process and manage CSS data. The CSS functions treat the data within an element as a CSS declaration or an array of CSS property-value pairs.

An important consideration for CSS processing is the use of shorthand notation. The SGML Object always prefers to write in CSS shorthand while properties are always stored in their most basic form. For example:

font: bold 9pt Courier New, Courier, Monospace

will be store as:

font-weight: bold

font-size: 9pt

font-family: Courier New, Courier, Monospace

When writing, the shorthand version will be rendered.

With this group of functions, there are two methods of accessing and changing CSS: via a declaration string or using property arrays. A an example of a declaration string:

margin: 0; font: bold 9pt Courier New, Courier, Monospace; border: Red 1pt solid

As array entries (assume ‘a’ is a single-dimension string array):

a["margin-top"] = "0";

a["margin-right"] = "0";

a["margin-bottom"] = "0";

a["margin-left"] = "0";

a["font-wieght"] = "bold";

a["font-size"] = "9pt";

a["font-family"] = "Courier New, Courier, Monospace";

a["border-top-color"] = "Red";

a["border-top-width"] = "1pt";

a["border-top-style"] = "solid";

a["border-right-color"] = "Red";

a["border-right-width"] = "1pt";

a["border-right-style"] = "solid";

a["border-bottom-color"] = "Red";

a["border-bottom-width"] = "1pt";

a["border-bottom-style"] = "solid";

a["border-left-color"] = "Red";

a["border-left-width"] = "1pt";

a["border-left-style"] = "solid";

The ordering of the array can be arbitrary. Property/key name case is always lower. Values are always represented in string form. Use the SGMLStringToValue, SGMLValueToString and related functions to convert to and from PVALUE form.

Unlike low-level SGML functions, mid level CSS functions are sensitive to data errors and will remove erroneous or unsupported data.

Mid Level Functions:

Related Low-Level CSS Functions (covered in other sections):