WML is a beautiful toy, like a swiss army knife to do web pages. It is
definitely a geek dream. In short, it allows you to mix a whole bunch of
programming language in your pages, which are then compiled, i.e. passed
through filters to handle each of them sequentially.
Well, ok. I assume this definition is not really helpful to understand
what WML is (trough it's perfectly correct ;). Let's try again. Using
wml, you don't write the html code directly, but you write a "source
code" which have to be processed (compiled). The main difference with
PHP is that it's not interactive. Contrary to PHP, the pages are not
recomputed each time the user clicks on a link, and are static.
So, why to use WML when it produces static pages?
Because it allows you for example to define some new tags, like the good
old <b> and <a href="...">. For example, I did define a
<frame> tag, and I use it to build all these nasty boxes all
around there.
But it's only one of the feature of this wonderful program. In fact, the
pages are processed through not less than 9 filters during the
compilation process, each of them offering a different set of
features. I don't use them all, and I marked my favorite ones in bold. I
would say that you can forget about the others for now.
- Pass 1: File inclusion. You can inline other files in the
current file. This feature allows you to share code between your
pages without copy/pasting it.
- Pass 2: High-Level Macro Construct Expansion. You can create
new HTML tags which encapsulate either raw text or even programmed
functionality of Pass 3 (ePerl).
- Pass 3: ePerl. You can do any Perl code you want in your
pages.
- Pass 4: Low-Level Macro Construct Expansion. Internal stuff
I don't really understand ;)
- Pass 5: Diversion filter. The idea is to define locations
(via "{ #NAME# }") at any point and fill such locations later by
diverting the data flow to it (via "{ #NAME#:" and ":#NAME# }") at
another point.
- Pass 6: Character and String Substitution. It allows you to
do some "search&replace" on the fly on your page. Useful to
change the 8-bit characters to the corresponding HTML entity
(é to é)
- Pass 7: Markup Code Fixup. Not that much is done, but
already good.
- Pass 8: Markup Code Stripping. Removes all the empty chars
that won't change the result, so that the page is smaller.
- Pass 9: Markup Code Splitting (slicing). This allows you to
divert the output of the compilation to a different file (if you want
to generate several HTML files — like translations — from the
same wml file).
|