Once you have selected an HTML based template in the template editor, access the "Variables" group in the "Edit template..." panel to manage variables which can be used by this template. When a variable is defined for a template, it can easily be customized from the build window for each build using that template, and scripts from this template can easily access its customized value to act upon it.
Create a new variable
By using the "New Variable" button, the "manage a template variable" window is shown with the following fields:
- Id: specify a unique identifier for that variable. This identifier will be used in the script files to access the customized content for that variable
- Name: the name of the variable as shown in the build window
- Description: the description of the variable as shown in the build window
- Kind: the kind of the variable which will provide a simpler way to specify its value in the build window.
- Bool: the variable contains a boolean value which can be either true or false
- Color: the variable contains a color value
- Enum: the variable contains a specific value chosen from one of the "Options" field (see "Options" bellow)
- Int: the variable contains an integer value
- Libpicture: the variable contains a reference to a picture available in the library of the currently open project. This is used to select an eBook cover for example
- String: the variable contains a piece of text
- Memo: the variable contains multi-line text
- Default value: when needed, the variable can have a default value which will be used if no other value is entered in the build window
- Options: for "Enum" variables, provides a list of available items to choose from, separated using the | character. E.g. "value1|value2|value3" will provide a choice between 3 values
- Translations: it is possible to translate the name and description of the variable to other languages supported by HelpNDoc. If needed, enter the translated values here so they can be stored in the template files, and displayed if HelpNDoc is set up in one of those languages
Edit a variable
Once a variable is selected in the list, the Edit Variable button will display the same window as when creating a new variable is shown (see "Create a new variable" above). Only the "Id" field is grayed out as it can't be modified for an existing variable.
Delete a variable
Once a variable is selected in the list, the Delete Variable button will delete that variable. Deleted variables won't be displayed in build settings anymore and can't be used by script files.
Other HTML based template settings: