Export templates are stored as a specialised from of Tinderbox note.
A note's availability as a template is stored in attribute $IsTemplate. An easy way to set this is via the document's Properties Inspector Prototype sub-tab has a check-box, Template. If this is checked, $IsTemplate is set to true
, the note's path appears in the template menu, and the note may be used as an export template. Note that an agent cannot also be a template.
Template notes appear in selection menus by their complete path. For example, if the template Book Template is a note inside the root-level container named "Templates", it appears in the menu as
/Templates/Book Template
and would be used in code thus:
^include("/Templates/Book Template")^
If a note's name (or path/name) is identical to the name of a template file, the note template will be used rather than the file.
Although a note anywhere in the document can be template (and may be in some long-lived TBXs), currently it is strongly advised to use the default location /Templates
. As the latter is not created by default (as not everyone uses/needs export) the easiest way to make this is to use File menu ▸ Templates and select any of the built-in templates. This creates the /Templates
folder and other configuration setting (e.g. an OnAdd making all new child notes a template, etc. You can always delete the built-in template used to create the container if not wanted.
As Tinderbox does not require $Name to be unique, it is possible to have other containers' called 'Templates'. But, if using the default root-level container for storing templates, avoid creating a same-named container that document root. Or, if such a duplicate is needed, ensure the container holding the templates is listed first by outline order ($OutlineOrder). Why? Because when resolving a duplicate $Name or $Path—in action code reference, agent queries/Finds, etc.—Tinderbox always uses the first match by outline order.
Note templates can be selected from text pane's HTML tab (only if no template has been initially set) or via the Export Inspector's Export tab.
Template notes (that use the 'HTML' built-in prototype) are configured to use settings like a monospace $TextFont and disabling smart quotes, and more.