[  Return to
     One-Day Meeting Home Page  ] [  Return to
     Cosmology Seminar Home Page  ]
[  Speaker
     Menu  ]

How to generate 150 HTML files easily


The posting of the transparencies for the one-day cosmology meeting was done with over 150 HTML files containing well over 1000 links. Even with an HTML editor that reduces each link to the click of a mouse, it would have been a lot of work to produce these files manually.

While an effective solution to this problem may already exist, my style is to write my own programs to do what I want done. The program I wrote is reasonably flexible, so I am including it here in case it can be of use to someone else. The program is written in PowerBasic, which runs only under DOS.

The HTML is generated from a source code written in a language that I will dub GML, which looks a lot like TeX. It allows the definition of macros almost exactly like TeX, except that the arguments must be delineated by curly brackets. It also allows conditionals, using \newif as in TeX, or using numerical if statements of the form \ifnum{expression 1}{operator}{expression 2} true-text \else false-text \fi. Here "expression 1" and "expression 2" can be numbers or macros that expand to numbers, and the operator can be =, >, <, <>, <=, or >=. The language also allows loops, defined by the form \do{variable name}{start}{end}{step}{text of loop}. I have used the anti-TeX convention that spaces following a macro name are not ignored, but the primitive \igfs (ignore following space) is defined to allow macros to be expanded without a following space. The primitive \sbr creates a linebreak in the HTML file.

To allow output to a number of files (in sequence), the primitive \file{dos-name}{unix-name} is used to open a file called dos-name (which can include a path). The unix-name is the name that the file is intended to have when used on a unix server, and it is used by the program to determine relative addresses. For example, if the unix-name is /www/oneday/odmt/odmt1.html, and the file /www/oneday/speaker.gif is used as an inline image, the reference will automatically be changed to ../speaker.gif.

I have not written a manual, but it might be useful to say that the primitives defined so far include the following. Words written in all caps are variables. More documentation can be found in the comments in the program's source file.

The following files may be of interest. The system is still under development, so use it at your own risk.


Send comments or questions to Alan Guth, guth@ctp.mit.edu.
Last modified: Monday, November 8, 1999 11:19 am