Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter ElevenSGML Functions (continued)

HTMLTidyCode Function

Overview

The HTMLTidyCode function takes an input stream of HTML code and tidies the code for spacing and replacing tags.

Syntax/Parameters

Syntax

string = HTMLTidyCode ( handle hData | string data, dword options], [handle log] );

Parameters

hData or data

A handle to a SGML Object, Mapped Text or Edit Object. Or,

A string containing HTML code;

options

An optional dword specifying conformance flags. The default value is 0x00000000, see Remarks.

log

An optional handle to a Log Object to receive any errors or warnings.

Return Value

A string containing the conformed code, a message or an empty string on error. Use the GetLastError function to retrieve a formatted error code.

Remarks

The HTMLTidyCode function takes a source HTML code base and cleans it up. this is useful for code that is bunched up or basically a mess and not human readable. Tags can also be cleaned up and bad data removed. The function reads each tag and character entity and then optionally writes an adjusted version back to the output string. In addition, the code can be tidied for conformed line endings and width.

Errors are reported and optionally normalized. If a log is provided, errors and warnings are dumped to the log.

Flags are as follows:

  SDK Definition   Bitwise   Description  
  General          
    HTC_ALL_OPTIONS   0x0000FFFF   All Options On  
  Tidy        
    HTC_TIDY_CODE_BREAKS   0x00000001   Tidy Code Breaks (blocks)  
    HTC_TIDY_CODE_LINE_ENDINGS   0x00000002   Tidy Code Line Endings  
    HTC_TIDY_CODE_WRAP   0x00000004   Wrap the Code  
  HTML Errors        
    HTC_REPORT_TAG_ERRORS   0x00000010   Report Tag Errors to Log  
    HTC_REPORT_CSS_ERRORS   0x00000020   Report CSS Errors to Log  
  HTML          
    HTC_REWRITE_CODE   0x00000040   Rewrites Corrected Tags  
    HTC_REWRITE_CHAR_ENTITIES   0x00000080   Rewrite Character Entities  
    HTC_REWRITE_CASE_MASK   0x00000300   Tag Case Mask Tags  
    HTC_REWRITE_CASE_DTD   0x00000000   Case Matches DTD  
    HTC_REWRITE_CASE_UPPER   0x00000100   Case to Upper  
    HTC_REWRITE_CASE_LOWER   0x00000200   Case to Lower  

 

The DTD is read from the source file. If a DTD DOCTYPE is not present, the default is HTML 5.

Note that is the DTD is XML, tag case is determined by the DTD.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic