{#require 2.0} {#include macro jlog.jim}{#define tt/x=x} {#include macro example.jam}\ Jamal=Just Another Macro Language v{version}

Just Another Macro Language v{version}

. . . . . . . . . . . . . . . . . . . . . . . . for HTML

On-line documentation ... {jamal} start page

TIPPS

{jamal} is complex and there are many ways one can use it. This document is a collected help without the intent of being precise or complex. Just ideas, tricks that come from the author as well as from users. Your ideas are welcome. I assume you have already read carefully the documentation.

{#define ChapCounter=1}\ {@define ref/x/y=
  • {ChapCounter}. y
    {#define x={ChapCounter}. y}\ {#define ChapCounter={#+ 1 {ChapCounter}}}}\ {@define anchor/x=

    {x}

    }\ {@define Ref/x={x}}

    Table of Contents

      {ref/naming/Naming files} {ref/build/Compiling projects} {ref/bodyncl/Including HTML BODY} {ref/infloop/Infinite looping}
    {@comment -------------------------------------------------------------------} {anchor/naming} Though {jamal} does not insist on file extensions it is a good practice to choose file extensions carefully and planned. I usually use the extension {tt jam} for those files that are compiled by {jamal} and result a file with the same name and different extension.

    The files that contain macros and are included by the {tt jam} files I call {tt jim}, as they are {jamal} include files.

    I usually put the {tt jam} and {tt jim} files into a directory which is different from the directory of the generated files. This directory is usually one level below the output file directory and I usually call it {tt source}. {@comment -------------------------------------------------------------------} {anchor/build} When I have a few {tt jam} files to compile I usually create a command file that compiles them. When there are many of them in a projetc I could use the UNIX utility {tt make}. But why use the right tool, when I have some thing less appropriate? I use {jamal} instead. I have a project where I craft some {tt jam} files and they each have to be compiled by {jamal} to {tt html} one directory higher. I create a file named {tt build.txt} with the following content:

    {@null
    {#define jamal=perl ../../progs/perl/jamal/jamal.pl}
    {@dir/./-f *.jam/
    {#if|{#>= {#-t {$file$name}} {#-t ../{$file$nam}.html}}|\ 
    {jamal} -m macros.jim {$file$name} ../{$file$nam}.html|}
    }}
    
    I use a command procedure that compiles {tt build.txt} using {jamal} and then executes the resulting command procedure. The result is each time a command procedure that compiles only those modules that were changed since their corresponding last compilation. Simple? No. But I like it. {@comment -------------------------------------------------------------------} {anchor/bodyncl} Many times we create HTML pages using some {jamal} template. In such a situation each {tt jam} file looks like:
    {@null
    {TemplateStart}
    
     text of the page
    
    {TemplateEnd}
    }
    
    where the macros are defined in a separate {tt jim} file and are included using the {tt -m} command line options. This gives a frame to the content opening the page and closing the page.

    But there is another way. Sometimes you just can not afford to have those two macros at the start and at the end of the file. Imagine an example, where a program generates a text file and you wan to convert it to HTML using {jamal}. You might not force the program to use those macro lines. The solution is to include the file into a {tt jam} file using the {tt include} {jamal} macro. But create only one {tt jam} file including the others, like

    {@null
    {TemplateStart}
    {#include {CurrentFile}}
    {TemplateEnd}
    }
    
    and compile it using the command
    {@null
    jamal -DCurrentFile=file.jim main.jam file.html
    }
    
    This is when the small fish eats the big one. {@comment -------------------------------------------------------------------} {anchor/infloop} Want to drive {jamal} into infinite looping? Simple:

    {@null
    {@define a={a}}{a}
    }
    This is when {jamal} eats processor.

    You are free to use and distribute {jamal} as far as your actions are in line with the GNU General Public License. I would also appreciate if you could include a reference text on one or more of the pages that you create on a site using {jamal}. This can be done using the predefined macro {#[}reference{#]}.
    {reference}