Index < Previous     Next >
The standard macro library wpplib [ ^ ]
Starting from wpp 2.13 I've slowly defined some extensions for wpp.
The INLINE, EVAL and SYSTEM functionality allows to write down complex features without hacking wpp code. My basic idea was to move every built-in macro outside wpp in the cleaner way possible for keeping the preprocessor as simple as possible.
A simple content managing system oriented macro library [ ^ ]
I've started developing this library for collecting some useful macros I've written mainly in order to track down the chaos of url checking and relativizing. The main concept is that when passing and url to a wpplib macro it can be relative (without the leading '/') or "absolute" (immagine that your website url start the output directory level).
Source raw/section2/index.raw
<!-- absoulte path -->
<!-- relative path -->
Output html/section2/index.html
<!-- absoulte path -->
<!-- relative path -->
Absolute urls will be "magically" casted into relative ones that can be used safely even if the generated documents wouldn't being placed at the root of a website.
The main advantage is that typing "/images/null.gif" it's safer than "../../images/null.gif", suppose you're moving to a different level one or more files holding relative references in the latter form: you have to check each of them and edit by hand everything.
The relativizing approach it's somehow useful even when you move the referenced file, this time you have to edit the sources but you know the original absoulte path and the final one: writing a search and replace command line script with your favourite tool (perl, sed, awk) it's really easy!

Anyway you can call any wpplib macros with a complete url.
Actually it's simply returned as is but in the near future will be (optionally) able to check even complete urls while generating documents.

Using wpplib [ ^ ]
Setup your config file in order to include the directory where 'wpplib.tmpl' is installed. For example suppose you have copied it into '/usr/share/wpp':
Or calling wpp by using the -D command line switch:
wpp -D DEFAULT_TMPLPATH=templates:/usr/share/wpp -
Once you've set up the template paths you can include safely wpplib.
@INCLUDE wpplib@
The macros exported by wpplib [ ^ ]
Macro Description
Returns wpplib version.
A simple macro that creates a red bordered box containing FIXME and the optional TEXT message.
It's used to wrap a 1x1 pixels transparent gif in order to expand to the wanted size (useful for filling spaces or forcing table sizes).
The first version generates an 1x1 image, the second version generates a square SIZExSIZE transparent image.
The image is by default the relativized url for '/images/null.gif', you can customize it by setting the variable @NULL_IMAGE@ with the proper url.
Return the relativized path.
If NODEPS is defined (not an empty string) dependencies will not be generated.

Note: RURL it's now a built-in macro since it's user internally by wpp for the other built-in macros.

Generates an "a href" tag. The EXTRA parameter is used for inserting other parameters into the first "a" part.
The URL, if it's a path, is relativized.
If NODEPS is defined (not an empty string) dependencies will not be generated.
Generates an "img" tag. The EXTRA parameter is used for inserting other parameters.
The IMG, if it's a path, is relativized.
Include a style sheet file reference using a "link" or a "style" tag.
^ Top < Previous     Next >