The format of source files
Lines of source-file text come in two flavours:
ordinary lines
which contain text and html markup, and
code lines
that begin with > followed by a space. Code lines
can be used for defining variables standing for strings.
The values of variables can be used in ordinary lines by
prefixing the variable name by a dollar sign, $, but only in
lines which are prefixed by a minus-sign, -, (which does not
appear in the resulting html). The use of the minus sign in this
way avoids unnecessary processing of lines that do not need it.
Code lines can appear anywhere.
Only their relative ordering matters.
In particular an ordinary line that uses a variable can
precede the code line in which the variable is defined.
See the source directory Doc_src of these web pages
to see an example.
Two variables are built in:
- TITLE
- CSS
Some functions that produce strings are built-in
- URL
- THISPATH
- LI
- EM
URL produces links. For example the code line
> link = URL "http://riscosnews.wordpress.com" "RO News"gives link the value
<a href="http://riscosnews.wordpress.com>RO News<a>LI produces list-items, EM emphasizes, THISPATH converts filenames relative to the target-directory into absolute filepaths. This is useful if your target-directory contains resources, such as databases, which your web-book needs to access. For example, if you have a database file of the form
=> { record1; ... }then the code-line
> db = dofile (THISPATH db_file)means that the n-th record is given by the expression db[n].