Introduction
wmg is a Perl-based system primarily aimed at generating documents in XHTML format, together with any supporting data (e.g. images). Typical uses include generating web sites and product documentation (including the document you are reading now). The system is driven by a set of templates, which pick sections from input articles to produce output documents. By default these are in XHTML format, but, by using different sets of templates, anything is possible.
|---------| | ARTICLE | | -XML | | -images | | | |---------| | ARTICLE | | -XML | \ / \-----/ \ / TEMPLATES \ / OUTPUT XML+perl ---- wmg ----> XHTML...
Source
This lives under the src directory, and contains:
- Articles - These XML files contain the textual content of the pages in XHTML, as well as other metadata, wrapped in a simple XML format. They can contain embedded perl commands, using the syntax.
- Source data - Data in its original form, which needs to be transformed in some way to produce the output. An example of this would be images, which need to be resized and have thumbnails produced for incorporating into an image gallery.
There are two ways in which articles can be stored - in hierarchical format and in chronological format. These can be used together if required. In hierarchical format, an article specifies
Templates
These live in the tpl directory, and contain instructions for transforming the source articles into the output documents. If an article does not specify which template to use, "default.wmg" is selected. Template files can include other template files, which allow common page elements to be maintained. A set of standard templates are supplied with wmg, which are used if one is not found in the site's tpl directory.
Output
This is placed under the html directory, and contains the output documents and data produced by wmg.