Originally, all templates for both plain text and HTML/formatted text export were external plain text files. All templates use the same export codes, with the main difference being that (plain) test export supports fewer features and - due to the way it works - doesn't support includes. Regardless of where stored, a template performs the same function in use.
Currently templates may be external of use internal notes. There are actually 4 categories of template:
- App built-in defaults. These are built into the app and are always available in any TBX document. The code for these cannot be accessed (though the code are listed in aTbRef) or inserted as with the other 'built-in' templates below.
- External templates. Plain text files, stored on the local OS, accessed via a fixed local path and edited using an external text editor. Use file extension as pertinent to content and the editor the OS will associate with the extension.
- Internal templates. Normal Tinderbox notes used to store export template code. Identified as such by setting the $IsTemplate attribute. Edited like any other note in the TBX
- Built-in Templates. Stored in the app, but available for addition to the current document. When so added, they function as normal internal templates.
Internal vs. External - pros and cons?
As wil be clear from the list, in the main the choice boils down to a users needs and preferred style of working as a 'pro' for one person may be a 'con' for another.
External:
- One file used with many TBX. Any change to a template affects all its users.
- Edited using external editor - for HTML templates, a user might prefer a dedicated HTML editor for this task.
- Separates export support files from actual content.
- Fixed local path with scope for breakage if moved. Possible amelioration is to link TBX to aliases to template files rather than the files themselves.
- Development with templates is cumbersome having to switch between applications.
- Reduced portability. Moving to a new computer involves moving the TBX and all associated templates (for which there is no easy listing).
- Using built-in templates involves copying out from an internal note.
Internal:
- Portable, templates always travel with the TBX (aTbRef contains all the templates needed to export it).
- Readily to hand. Templates are just another note in the current TBX.
- Only work with their parent TBX. If used in multiple TBXs, an edit must be made to the note in each TBX. However, templates may be dragged between TBXs like normal notes.
- Editing template code is done in a TB note. In v5, new attributes and prototypes have made editing easier - e.g. turning off paragraph spacing, smart lists, using monospaced fonts