The ARexx script that builds this site uses a tree-based menu definition in which, using an n.x.y=z type compound variable, x represents the level in the menu tree, y represents the number of pages present at that level, and z represents the number of descendents which that page node has. The stem, n., is initialised to -1 to allow the tree searching routines to recognise unused page nodes. For example...

        n.=-1

        n.0=4    /* 4 levels */

        n.1.1=10 /* this root page has ten descendant pages */
                 /* in other words this page has ten menu options */
                         
        n.2.1=2  /* first page at second level has two descendant pages */
        .        /* two menu options for this page! */
        .

With this definition available the required pages are generated using the following loop...

        do level = 1 to n.0        
           page_start=0
           say CountNodes(level) 'pages at level' level
           do node=1 to CountNodes(level)
              entries=n.level.node
              call GeneratePage(level,node,page_start,entries)     
              page_start=page_start+entries      
           end
        end

This effectively carries out a level-by-level search of the menu tree. Because, however, both level and page numbers are known during this loop it is possible for the GeneratePage() routine to automatically generate a page name in the form LxPy.htm (where x is the level and y is the page number). Similarly the names of the equivalent title and text files (LxPy.title and LxPy.txt) can also be produced.

In this way the page creation routine is able to use ARexx's Exists() function to check whether page title or page text files are available for each page being generated. If a file is found it is read in and used as appropriate. When such files are not found default page headings and menu entries are inserted instead. Date stamps files are similarly checked for and inserted into the final HTML file.

Additional, and more detailed, explanations of how this is achieved will be posted here in due course!