Templates plugin

About

The Templates plugin can be used to insert code (or text, markup, etc.) templates into the current buffer. As of this writing, Templates supports the import of static text files only.

Usage

At startup, the Templates plugin scans the user's template directory. By default, this is a directory called "templates" under the user's jEdit settings directory (refer to jEdit documentation). This directory is user-configurable via the "Templates" tab accessed using the "Plugin Options" facility.

A new "Templates" submenu is inserted on the "Plugins" menu, and each file in the templates directory results in a menu item being added to that submenu. As of version 1.0.0, the text for these menu items can be specified using the #ctpragma LABEL (or #ctpragma NAME) directive (see #ctpragma Directives below). The plugin will scan subdirectories recursively, and each subdirectory will result in a new submenu.

To make use of the template files, position the cursor at the point at which you wish the text inserted, and select the appropriate file from the "Templates" menu. The full text of the file will be inserted into the current buffer at the cursor position.

If new templates are added to the templates directory, the "Refresh templates" menu item may be used to update the templates menu. The templates menu is automatically refreshed if a new directory is selected under "Plugin Options".

NOTES:

- the Templates plugin will disregard any file which conforms to the jEdit backup file format (ie. contains the backup prefix and/or suffix defined in the "Global Options" settings.

- all files in the templates directory which do not match the backup format described above, are assumed to be template files (this may change in future).

- if the selected templates directory does not exist, it will be created.

#ctpragma Directives

The Templates plugin pre-processes template files on import. The behaviour of the Templates preprocessor can be influenced through the use of #ctpragma directives. These directives use the following format:

#ctpragma TYPE = Value

where "TYPE" indicates the directive type, and "Value" is a string value.

Any single directive must be contained on a single line, and any given line must contain only one directive. A directive type which is not recognized is ignored. All lines containing #ctpragma directives are stripped from the template when imported. At this time, Templates supports the following directive types:

Contact

Send comments or questions to Steve Jakob at
Steve.Jakob@lrcc.on.ca