Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.4j

Application v 5.22b

  

 

Chapter ElevenSGML Functions (continued)

11.11 HTML Style

11.11.1 General

The HTML Style Object (Style Object) provides a platform to code inline style information. When adding style information, it can sometimes be difficult ensure that tags are ordered correctly or difficult to formulate a coding set for specific text. The HTML Style Object allows a text series to be constructed, adjusted, and then rendered whole or in part with the correct coding sequence. 

While the HTML Writer Object has style functions, the Style Object is separate and distinct.

11.11.2 SGML Object 

The HTML Style Object is closely dependent and related to the SGML Object. As tags are parsed by or added to the SGML object, they optionally can be added to the Style Object.

An internal SGML can also be be employed.

When a dependent SGML Object is employed, certain operations performed with the Style Object will impact the SGML Object.

11.11.3 Operation

The Style Object provides a platform to spool on text and style information and then render that information as properly structured HTML.

Generally, a Style Object is created and then reused repeatedly as HTML blocks are built. The DTD is determined either directly, as specified during the create, or indirectly by association with an SGML Object.

Information is added via the HTMLStyleAddAttribute, HTMLStyleAddBlock and HTMLStyleAddItem functions. As text and HTML tags are added, the style tags are absorbed into the object and used to create a combination text and style map. As such, the X positions within text buffer may not match the incoming data.

The style for the text buffer can be examined using the HTMLStyleGetProperties function. Any conflicting areas are marked as mixed, meaning the area is in conflict. Take the following example:

This is a line with some <b>bold</b> data. 

If the style properties are retrieved for the word “bold”, the font-weight property will be set to bold. However, if the properties are retrieved for the entire buffer, the value will be (mixed).

Style can be adjusted for the entire buffer or a selected area using HTMLStyleSetProperties function. Both the get and set functions use the same key names.

The HTMLStyleNormalize function can be used to remove certain styles and properties which may be superfluous depending on the context. For example, a font-weight value of normal, generally does nothing unless the parent style or CSS sheet has specified a weight.

Once the style has been adjusted, the HTMLStyleRenderCode function can be used to retrieve all or part of the finalized code. If needed, the text can be retrieved using the HTMLStyleRenderText functions.

Finally, the Style Object can be reused by executing the HTMLStyleReset function.

11.11.4 Functions