Man page for ./wpp.1
WPP(1) WPP(1)
NAME
wpp - Web-site macro preprocessor
SYNOPSIS
The Web PreProcessor (wpp) is a simple but powerful macro
preprocessor for web sites and other similar applications.
Wpp is based on "m4", a standard macro preprocessor for
languages such as C. It accepts no arguments, and
descends the directory hierarchy starting from the current
directory. Any file whose name is of the form
"base.m4.extension", is macro preprocessed, generating an
output file with name "base.extension". For example, file
index.m4.html generates index.html.
Macros may be defined in the files being processed, but
more commonly are defined in separate files whose names
are of the form "base.m4". These files are referred to as
"macro definition files" and do not generate output files.
They may be located anywhere in the directory tree, pro-
viding a simple but effective scoping mechanism. All
macro definition files in the current directory (as pro-
cessing recursively descends), and in all parent directo-
ries up to the original directory, are concatenated before
each file in the current directory is preprocessed. For
example, consider the directory directory structure:
aux.m4.html
index.m4.html
mymacros.m4
sub/goodstuff.m4
sub/moredata.m4.html
sub/moremacros.m4
When wpp is invoked it reports its actions as follows:
Creating aux.html using mymacros.m4
Creating index.html using mymacros.m4
cd sub
Creating moredata.html using ../mymacros.m4
goodstuff.m4 moremacros.m4
cd ..
Each output file is created via a separate execution of
m4. The input to m4 is the concatenation of all macro
definition files (starting with wpp.init), followed by the
source file to be processed. This is presented as a sin-
gle stream, so that text, not just macro definitions, may
be present in macro definition files. We discourage this
however, and suggest that the macro definition files con-
tain only definitions, and the source files contain none.
If a directory contains a file named ".nowpp" it is
skipped. Also, files containing the symbols "~" or "#"
are skipped.
1
WPP(1) WPP(1)
WRITING MACRO DEFINITIONS
The short story:
- Writing m4 define(foo,bla) will replace "foo" with "bla"
in all remaining text.
- Writing m4 define(foo,bla$1), and then foo(xx), will
result in blaxx.
- We suggest that your macro names begin with some special
sequence such as " " to avoid conflicts with your text.
- Text is quoted using matching single quotes. That is, a
left single quote and a right single quote. For example
`this is text (words), and that is all'.
- Quoting is only relevant when collecting macro argu-
ments, including those to m4 define().
- The value of a quoted string is the string stripped of
quotes.
- The quotes are needed in:
m4 define( foo,`this is text (words), and that is all')
because the second argument contains both a right paren-
thesis and a comma.
- Watch out for possessive words. To quote the phrase
"John's story was long" you must write `John''`s story was
long'.
- Quotes are *very* confusing under m4. Here are a few
additional notes: Quotes can be nested, but interior sin-
gle quotes will vanish unless they are doubled. In this
case single quotes remain. If the outermost quotes are
double they still vanish, but all interior quotes remain.
The full story: - See the m4 man page. Note that
its commands have been redefined by wpp.init so that they
begin with "m4 ", in order to avoid conflicts with source
text.
- See our definition of simple counter macros in wpp.init,
for an example of the use of these commands.
INSTALLATION
1) Copy files wpp and wpp.init, to your bin, or some other
directory which is on your search path.
2) (optional) Install the man page.
2
WPP(1) WPP(1)
SEE ALSO
m4(1)
AUTHOR
Peter N. Yianilos
3