template_functions.pl API
The following Perl subroutines from
template_functions.pl
provide the template functionality for
template wrappers. They are mostly variations of search and replace functions.
- replace (@file)
- Replace each meta-variable with the result of the real thing the %data associative array.
- @file should contain a file, one line per index. %data is an associative array containing all the data we expect to see in the template.
- NB: %data IS A GLOBAL VARIABLE.
- Also responsible for replacing escaped # controls, such as #if and #foreachrow..#endforeachrow.
- run_exec (@file)
- Execute the contents of $exec{}
- localise (@file)
- Returns localised file contents.
- NB: this subroutine only gets called once, after &replace and &run_exec have been called.
- externalise (@file)
- Returns externalised file contents.
- NB: this subroutine only gets called once, after &replace and &run_exec have been called.
- clean (@file)
- Clean up file (remove #local..#endlocal and #external..#endexternal).
- write_file ($filename, @file)
- Write @file into a file named $filename.
- replace_local_path ($local_flag, @file)
- replace "@local_path" operator with local web space pathname if $local_flag == 1, otherwise leave it blank.
- Used for resolving URLs in templates that depend on whether the page produced is local or external.
- house_style_start ($sider, $title)
- Takes a location of an image (to use as a sider) and a title to insert into the house style template
- house_style_end
- Output end part of house style
- read_file ($filename)
- Read specified file and return as a single string
- create_button_string
- Create HTML for button bars
- Arguments: @buttons
- Returns: HTML string if OK
- 0 otherwise
- Copyright Richard Jones, 1997
- get_this_url ($filename [, $passed_url_stem])
- Get URL for $filename
- munge_Latex ($string)
- Take a string containing Latex markup and return an HTMLised copy











