Macro-HTML Compiler v1.0 (C) 1999 A'rpi/ESP-team ======================== Description: ~~~~~~~~~~~~ This is a simple macro-compiler for text and HTML files. You can define and call macros, and access parameters on command line. The syntax is very similar to BAPC's language, the only difference is that end of macro is signed by a '#', not ENDM or EOL. The compiler also skip DOS-style newlines (#13), and allow maximum 2 empty lines after eachother in output, it makes HTML files readable. It was designed to help managing a big site (ESP-team's homepage), which is mirrored at many places, and addresses are changed very often. I built the site from macros, so the source isn't redundant, changes can be made very easy! Writting a section for a new program is easy too. Usage: ~~~~~~ mhtml [parameters] < source.mhtml > dest.html If you want to append multiple source files: cat *.mhtml | mhtml [params] > dest.html I'm using: cat global.mac local-1.mac header.mac *.mhtml footer.mac | mhtml > page.html Macro definition: ~~~~~~~~~~~~~~~~~ #macroname=contents# Macroname must be from a character set 'A'..'Z', '0'..'9' and '_'. Contents part can contain spaces and newlines as well. You can access parameters (passed to the macro) by %n, where n is a number 0..9. There is a special macro defined by default, called ARG(n), it returns with the n'th argument in the command-line. Macro call: ~~~~~~~~~~~ $macroname or $macroname(parameters) You can use %n in the parameters part! Special characters: ~~~~~~~~~~~~~~~~~~~ You can quote chars with backslash (\) character. You have to quote hash (#), dollar ($) and percent (%) chars, because they have special meaning in this macro-language. Comments: ~~~~~~~~~ You can put comment into the source file including ` chars: `This is a comment` These comments won't be written to the output. If you want HTML comments, use the standard style. Example: ~~~~~~~~ Source file 'src.mhtml': #B=%1# #R=
# #LINK2=%2# #EMAIL=$LINK2("mailto://%1","%2 <%1>")# #DOMAIN=$ARG(1)# #A_ARPI=$EMAIL("arpi@$DOMAIN","A'rpi")# #A_PILU=$EMAIL("gpilaszy@$DOMAIN","Pilu")# $B(Authors:) $A_ARPI and $A_PILU $R Compile: mhtml esp-team.scene.hu < src.mhtml > page.html Output file 'page.html': Authors: A'rpi <arpi@esp-team.scene.hu> and Pilu <gpilaszy@esp-team.scene.hu>