Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter ElevenSGML Functions (continued)

HTMLGetContext Function

Overview

The HTMLGetContext scans an HTML file and returns the context stack, as it stands, from the last scan.

Syntax/Parameters

Syntax

string [][] = HTMLGetContext ( handle hObject );

Parameters

hObject

A handle to an HTML Context, SGML, Mapped Text or Edit Object.

Return Value

A string table containing a row entry for every element in the element stack or an empty array on failure. Use the GetLastError function to retrieve a formatted error code.

Remarks

The function will dump the HTML element stack, as is standard from the end of the last scan.

A table with the following column keys are returned:

  Key Name   Description  
  element_token   Hexadecimal version of the element token.  
  element   String version of the element, as translated by the DTD.  
  s_x   Decimal zero-based x position of the start of the tag.  
  s_y   Decimal zero-based y position of the start of the tag.  
  e_x   Decimal zero-based x position of the end of the tag.  
  e_y   Decimal zero-based y position of the end of the tag.  
  e_type   Hexadecimal version of the bitwise element type.  
  d_cnt   Descendant Count.  
  s_pos   Zero-based sibling position.  
  i_no   Decimal value of the list item number.  
  l_type   Hexadecimal version of the list type.  
  t_no   Decimal value of the serial table number.  
  t_tl   Decimal value of the table level. If zero, not in a table.  
  t_r_no   Decimal value of the row number.  
  t_c_no   Decimal value of the column number.  
  t_c_pos   Decimal value of the column position (accounting for spans).  
  t_c_span   Decimal value of the column span value.  
  c_i1   Decimal value of the caller integer.  
  c_i2   Decimal value of the caller integer.  
  c_d1   Hexadecimal version of the caller dword.  
  c_d2   Hexadecimal version of the caller dword.  

 

A point of interest must be set for the scan in order to read the stacked elements at the position. The scan must have a stop position. If the overall file is not balanced and a stop position not set, any extra open tags will show up at the end point context.

The e_type parameter is a complex bitwise value with the following defined bits:

  Define   Bits   Description  
  Types (ordinal & bitwise)       (Ordinals for Context Stack)
(Bitwise for Stack Popping)
 
  Masks          
    HC_STK_TYPE_MASK   0x0FFF000F   Mask for Complete Type  
    HC_STK_ORDINAL_MASK   0x0000000F   Mask for Type Ordinal  
    HC_STK_FLAG_MASK   0x0FFF0000   Mask for Flags  
    HC_STK_ELEMENT_MASK   0x00FF0000   HTML Element Bits  
    HC_STK_FIELD_MASK   0x0F000000   Field Bits  
  Types (combined bit/ordinal)        
    HC_STK_PCDATA   0x00000000   No Type (PCDATA)  
    HC_STK_INLINE   0x00010001   Inline Type (SPAN, B, I...)  
    HC_STK_BLOCK_SOFT   0x00020002   Block Type (P...)  
    HC_STK_BLOCK_HARD   0x00040003   Block Type (DIV, CENTER...)  
    HC_STK_CONTAINER   0x00080004   Container (TABLE, TBODY ...)  
    HC_STK_HEADER   0x00100005   Header Tags (BASE, TITLE...)  
    HC_STK_BODY   0x00200006   Body Container (BODY)  
    HC_STK_FIELD_BLOCK   0x04000007   Field Block Container  
    HC_STK_FIELD_INLINE   0x08000008   Field Inline Container  
  Types (ordinals)          
    HC_STK_TYPE_PCDATA   0x00000000   No Type (PCDATA)  
    HC_STK_TYPE_INLINE   0x00000001   Inline Type (SPAN, B, I...)  
    HC_STK_TYPE_BLOCK_SOFT   0x00000002   Block Type (P...)  
    HC_STK_TYPE_BLOCK_HARD   0x00000003   Block Type (DIV, CENTER...)  
    HC_STK_TYPE_CONTAINER   0x00000004   Container (TABLE, TBODY ...)  
    HC_STK_TYPE_HEADER   0x00000005   Header Tags (BASE, TITLE...)  
    HC_STK_TYPE_BODY   0x00000006   Body Container (BODY)  
    HC_STK_TYPE_FIELD_BLOCK   0x00000007   Field Block Container  
    HC_STK_TYPE_FIELD_INLINE   0x00000008   Field Inline Container  
  Type Flags (bits)          
    HC_STK_FLAG_PCDATA   0x00000000   No Type (PCDATA)  
    HC_STK_FLAG_INLINE   0x00010000   Inline Type (SPAN, B, I...)  
    HC_STK_FLAG_BLOCK_SOFT   0x00020000   Block Type (P...)  
    HC_STK_FLAG_BLOCK_HARD   0x00040000   Block Type (DIV, CENTER...)  
    HC_STK_FLAG_CONTAINER   0x00080000   Container (TABLE, TBODY ...)  
    HC_STK_FLAG_HEADER   0x00100000   Header Tags (BASE, TITLE...)  
    HC_STK_FLAG_BODY   0x00200000   Body Container (BODY)  
    HC_STK_FLAG_FIELD_BLOCK   0x04000000   Field Block Container  
    HC_STK_FLAG_FIELD_INLINE   0x08000000   Field Inline Container  
  Bitwise Testing          
    HC_STK_IS_BLOCK   0x00060000   Block Mask  
    HC_STK_INLINE_STOP   0x003E0000   Combo for Inline Stop  
  Indicator (Bitwise Flags)          
    HC_STK_NO_CLOSE   0x10000000   Special Type (BASEFONT)  
    HC_STK_HAS_PCDATA   0x20000000   PCDATA Was In Nest  
    HC_STK_HAS_DISPLAY_DATA   0x40000000   Has Data that Renders  
  Display Types (CSS)          
    HC_STK_DISPLAY_DEFAULT   0x0000FF00   (default)  
    HC_STK_DISPLAY_INLINE   0x00000000   Inline  
    HC_STK_DISPLAY_BLOCK   0x00000100   Block  
    HC_STK_DISPLAY_LIST_ITEM   0x00000200   List-Item  
    HC_STK_DISPLAY_RUN_IN   0x00000300   Run-In  
    HC_STK_DISPLAY_COMPACT   0x00000400   Compact  
    HC_STK_DISPLAY_MARKER   0x00000500   Marker  
    HC_STK_DISPLAY_TABLE   0x00000600   Table  
    HC_STK_DISPLAY_INLINE_TABLE   0x00000700   Inline-Table  
    HC_STK_DISPLAY_TABLE_ROW_GROUP   0x00000800   Table-Row-Group  
    HC_STK_DISPLAY_TABLE_HEADER_GROUP   0x00000900   Table-Header-Group  
    HC_STK_DISPLAY_TABLE_FOOTER_GROUP   0x00000A00   Table-Footer-Group  
    HC_STK_DISPLAY_TABLE_ROW   0x00000B00   Table-Row  
    HC_STK_DISPLAY_TABLE_COLUMN_GROUP   0x00000C00   Table-Column-Group  
    HC_STK_DISPLAY_TABLE_COLUMN   0x00000D00   Table-Column  
    HC_STK_DISPLAY_TABLE_CELL   0x00000E00   Table-Cell  
    HC_STK_DISPLAY_TABLE_CAPTION   0x00000F00   Table-Caption  
    HC_STK_DISPLAY_NONE   0x00001000   None  

 

Related Functions

Platform Support

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

Legato IDE, Legato Basic