In order to be able to insert the values of some environment variables during the evaluation process, the Document Generator provides several functions that may be used in entity definitions or templates:
&base(file);
removes path information and extension from the file
specification.
Example:
&base(/home/bscw/www/faq.dtm);
results in faq
&rel(path);
generates a
relative path name out of an absolute one. The generated path name is relative
to the document that will be generated (set in the evaluation parameter
document).
Example: If the expression
&rel(/Images);
is used in a template, that generates the
document /faq/index.htm
, this expression will be evaluated to
../Images
. If one uses the same expression in a template that
generates the document /faq/question/ install.htm
, it will be
evaluated to ../../Images
.
&size(file, [B|K|M|G]);
returns the size of a file in bytes, kilobytes, megabytes or
gigabytes, depending on the value of the second parameter.
Example: &size(/Download/bscw34.exe, M);
results in
8.43
&date(format);
returns the current date and time. The following directives may
be used in the format
string. They are shown here without
the optional field width and precision specifications.
Directive |
Meaning |
|
Locale’s abbreviated weekday name. |
|
Locale’s full weekday name. |
|
Locale’s abbreviated month name. |
|
Locale’s full month name. |
|
Locale’s appropriate date and time representation. |
|
Day of the month as a decimal number [01, 31]. |
|
Hour (24-hour clock) as a decimal number [00, 23]. |
|
Hour (12-hour clock) as a decimal number [01, 12]. |
|
Day of the year as a decimal number [001, 366]. |
|
Month as a decimal number [01, 12]. |
|
Minute as a decimal number [00, 59]. |
|
Locale’s equivalent of either AM or PM. |
|
Second as a decimal number [00, 61]. |
|
Week number of the year (Sunday as the first day of the week) as a decimal number [00, 53]. All days of a year preceding the first Sunday belong to week 0. |
|
Weekday as a decimal number [0 (Sunday), 6]. |
|
Week number of the year (Monday as the first day of the week) as a decimal number [00, 53]. All days of a year preceding the first Monday belong to week 0. |
|
Locale’s appropriate date representation. |
|
Locale’s appropriate time representation. |
|
Year without century as a decimal number [00, 99]. |
|
Year with century as a decimal number. |
|
Time zone name (or empty string if no time zone exists). |
|
The character
‘ |
Example: On October 10, 2005 the result of
&date(%B %Y);
is October 2005
.