Chapter 13. ComPact Extended HTML Specification

Table of Contents
13.1. ExHTML Syntax
13.2. ExHTML Expressions

Most of the HTML pages that form the Elego ComPact GUI are no ordinary HTML texts, but contain some special syntax that is used to generate dynamic and iterative content. This syntax takes the form of a simple imperative scripting language based on dynamic value bindings called environments, a special ASSIGN tag that is used to denote the start and end of the script, a special replacement syntax for expression applications, and a small number of various other useful tags, for example for substitution of command output.

The interpreter for these new language constructs is built into the ComPactHTTPd server. If a request for a dynamic page is serviced, the page is located, passed through the ExHTML interpreter, which executes the statements inside the ASSIGN tags and substitutes all expression applications, and finally passed as pure HTML to the browser.

The basic data types of ExHTML are texts, lists of texts, and cardinal numbers. The language contains the basic elements assignment, statement sequence, text expression, list expression, if-statement, and foreach-statement. Thus the number of available constructs if not very big, but sufficient for the purpose of generating a dynamic HTML interface for configuration management. There are several dozens of built-in functions that are used to do most of the work.

The next section gives a short sketch of the general ExHTML syntax, while all the available ExHTML functions are explained in Section 13.2.

13.1. ExHTML Syntax

Let [list] be a predefined non-terminal to type any list of text-constants. Every variable has either the type [cex], [text] or [list] (see Expressions). ExHTML just looks like normal HTML, but with three additional features:

  1. A new *tag* of the form:

    '<SourceOutput>'
    


    This tag supports to write generic html pages for program execution as well as for file content output. The content of the internal reader (initialized by Execute resp. Show paths) will be written where its application is found.

  2. A new *assignment-tag* of the form:

       [assignment-tag] ::=  '<ASSIGN>'  [statementseq] '</ASSIGN>'
    
       [statementseq]   ::=  *([statement])
    
       [statement]      ::=  [assignment]  
                        |    [if-statement]  
                        |    [foreach-statement]
    
       [assignment]     ::=  [variable] '=' [expr]   
    
       [expr]           ::=  [tex]    -- text-expressions (docu follows)
                        |    [lex]    -- list-expressions
                        |    [bex]    -- boolean expression (represented as text)
    
       [bex]            ::= "yes" | "no"
    
       [if-statement]   ::=  'IF' [bex] 'THEN' 
                           {     [statementseq] }
                           { 'ELSE'
                                 [statementseq] }
                             'END'
    
       [foreach-statement] ::=  'FOREACH' [variable] 'IN' [lex] 'DO'
                                    [statementseq]
                                'END'
                 
    


    The [foreach-statement] introduces a temporary text-variable [variable], which iterates over all elements in the text-list [lex]. This variable should not exist in the environment of the [foreach-statement] and must be fresh.

    The assignment-tag will be interpreted and eliminated from the html-source by the server. Its purpose is to introduce und initialize temporary variables.

    Variables exist in environments which belong to sessions, contexts, querys-strings, and requests. Environements are stacked. During the evaluation of every query, there are at least four stacked environments:

        local environment
             |  (exists while the request is being processed)
             |
             V
        context environment
             |  (bindings associated with the current process,
             |   package, pool, or directory context)
             V
        session environment
             |  (bindings associated with the current session)
             |
             V
        global environment
                (constructed from the configuration files and
                 the process environment)
                 
    


    Definitions of local variables hide variables in deeper stack frames with the same name. Variables lookup searches through all the stack frames. Variables in deeper stack frames can never be written directly, they will just be hidden by a local binding.

  3. *expression-application* of the form:

       [exappl] ::= '${'[expr]'}'
    
       [expr]   ::= [cex] | [tex] | [bex] | [list] 
                 
    


    An expression-application [exappl] will be parsed, evaluated and substituted by its actual value in the html-source. Note, that list-variables will be flattened. Note also, that expression-applications will also be expanded in text-constants within an assignment-tag environment.



If a syntax error is found during the parsing of an assignment-tag or expression-application the server immediately generates an ErrorPage.