Including external files and scripts is essential in order to manage even the simplest web sites.
You can place common fragments of HTML code like headers and footers into separate files and include them in every page. This way you can update a single file and see changes spreading all over the site, reducing errors and waste of time.
External scripts can be used to create complex navigations bars, history stacks and so on..
Include a verbatim copy of file_name
without interpreting
its contents; file_name
can be any valid expression:
verbatim ("literal_file_name");
verbatim (variable_storing_file_name
);
verbatim (variable_storing_name
+ variable_storing_extension
);
Remember that file names must be relative to the directory storing the file where the
verbatim ()
function occurs.
Warning: If you use Cows-mkgen to create makefiles,
file_name
can only be provided as a string constant (e.g. "foo.html") or via theinputfile ()
andoutputfile ()
functions; otherwise, Cows-mkgen will miss the dependency and raise a warning.Of course, Cows will correctly include the file, since it can handle complex expressions, but if the included file is changed, make won't update output file. For further informations see Section 24.1.
Assuming file quote.html contains the following text:
Ask the experimenters why they experiment on animals, and the answer is: "Because the animals are like us." Ask the experimenters why it is morally OK to experiment on animals, and the answer is: "Because the animals are not like us." Animal experimentation rests on a logical contradiction. -- Professor Charles R.Magel
You can include its content within your script with the following code:
verbatim ("quote.html");
Cows' output will be:
Ask the experimenters why they experiment on animals, and the answer is: "Because the animals are like us." Ask the experimenters why it is morally OK to experiment on animals, and the answer is: "Because the animals are not like us." Animal experimentation rests on a logical contradiction. -- Professor Charles R.Magel
This manual can be downloaded from http://www.g-cows.org/.