The various outputs of a project can use different template files by assigning the template file name to the property Delphi Output Template Name in the property page for each output. If no template is assigned to the property, the default template will be used ("Standard_WinHelp.tpl" for WinHelp, "Standard_HTMLHelp.tpl" for PlainHTML and HTML Help).
All WinHelp templates must be located in "Templates\Delphi\WinHelp" (under the "Time2HELP" install directory), PlainHTML and HTML Help templates must be located in "Templates\Delphi\html".
Templates
The template files consist of templates on the form
<template Name=SomeTemplate> .. </template>
Template Objects
The internal structure of Time2HELP can be accessed through the Template Objects. The template objects have string- and boolean properties that can be accessed from the templates.
String Properties
The values of the string properties of the template objects can be inserted into the generated topic files. The example below demonstrates how the link from a class topic to its unit topic is created. The template fragment belongs to the ClassTopic template ("<Template Name=ClassTopic>") in the standard WinHelp template file. The unit under processing in this example is named "Unit1". The fragment:
<Jump Text="[%Unit.Name%]" ID="IDH_Unit_[%Unit.Name%]">
will insert the following text in the generated topic file:
<Jump Text="Unit1" ID="IDH_Unit_Unit1">
Boolean properties
The boolean properties can be accessed for conditionally inserting text. The template fragment below, also from the ClassTopic template, will insert the "Description" heading and the description text of the class being processed if the class has a description:
[%If Class.HasDescription%]<P><B>Description</B><BR> [%Class.Description%][%Endif%]
Methods
The methods (or emumerators) are used to instantiate a template for set of objects. For example, the following
[%Class.EnumIntroducedProperties>>PropertyTopic%]
will instantiate the PropertyTopic template for each of the introduced properties (represented by Property-objects) of the class being processed.
See also
Template Objects Overview
Example: Changing the implementation heading style
|