1. Introducing BML

1.1. Blocks

BML is essentially a simple macro language. Macros are called blocks in BML. Blocks are defined in look files, and are invoked in BML files. Blocks accept parameters and are divided into several types, according to how parameters are transmitted and how the definition of the block is able to make use of them. Definitions of blocks are essentially chunks of HTML with potentially more recursive BML block invocations inside them.

Example 1.1. BML lookup file

project=>The Alabaster Project

greeting<=
<p>Welcome to <?project project?>, a joint effort between the citizens of Earth
and Acme, Inc.</p>
<=greeting

The “project” and “greeting” constructs in the above example lookup file are blocks, and can be used to insert their respective content into HTML output. The “project” block is a single-line block that consists of everything immediately following the name of the block and the => up to the end of the line. The “greeting” block is a multiline block, and contains all the lines immediately following the greeting<= line and preceding the <=greeting one.

1.2. BML Files

A BML file is just an HTML file with some BML block invocations in it. Each such invocation specifies the name of the block, and the parameters, if any, to pass to it. The ultimate result of a block's invocation at runtime is HTML which is put in the outgoing stream at exactly the place where the block's invocation was in the BML file.

Example 1.2. BML file

<html>
  <head><title><?project project?></title>
  <body>
    <h1><?project project?></h1>

    <?greeting greeting?>
  </body>
</html>

Given the lookup file from the previous example, the BML file above would yield output like:

Example 1.3. Output

<html>
  <head><title>The Alabaster Project</title>
  <body>
        <h1>The Alabaster Project</h1>

        <p>Welcome to The Alabaster Project, a joint effort between the citizens of Earth
and Acme, Inc.</p>

  </body>
</html>

The block invocations in the BML lookup file example above do not contain parameters. They are still a powerful way of building a document out of aggregate parts. Adding parameters, of course, increases this usefulness.