scene.org File Archive

File download

<root>­/­mirrors­/­flerp­/­.s­/­groups.hun­/­ESP-team­/­linux/Macro-HTML-v1.0.txt

File size:
2 591 bytes (2.53K)
File date:
2013-11-26 23:08:44
Download count:
all-time: 55

Preview

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 <!-- comment --> style.

Example:
~~~~~~~~
Source file 'src.mhtml':
  #B=<B>%1</B>#
  #R=<BR>#
  #LINK2=<A HREF="%1">%2</A>#
  #EMAIL=$LINK2("mailto://%1","%2 &lt;%1&gt;")#

  #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':

  <B>Authors:</B> <A HREF="mailto://arpi@esp-team.scene.hu">A'rpi
  &lt;arpi@esp-team.scene.hu&gt;</A> and
  <A HREF="mailto://gpilaszy@esp-team.scene.hu">Pilu
  &lt;gpilaszy@esp-team.scene.hu&gt;</A>