![]() | The Kate Template Format |
Prev | File Templates | Next |
If you use files with the extension katetemplate, they will be parsed for template information, macros and a cursor position.
While reading in the file, the parser keeps lines beginning with the phrase katetemplate: and searches them for template information in the form VARIABLENAME=VALUE. The first line not sta rting with katetemplate: will be taken as the start of the template contents. VALUE may contain any character but euqal sign (=). Legal variable names are:
This is the template name, displayed in the File->From Template menu.
The group places the template in a submenu of the File->From Template menu.
This is the name that will be set for the document, and displayed in the file list and title bar. If the name contains %N that will be replaced with a number, increasing if more documents has the same name.
The plugin will try to set the Highlight for the new document to the value of this variable. The value should be the name, as found in the Tools->Highlight.
A short informative description of the template. This is currently used to set a Whatsthis string for the menu item, but may be used for more purposes in the future.
A string identifying the author, for example in the form Name <email address>. This is currently used to set a Whatsthis string for the menu item, but may be used for more purposes in the future.
While parsing the template contents, macros in the form %STRING are expanded. The following macros are supported:
Expands to the current time in your locale format, as returned by QTime::currentTime().toString().
Expands to the current date in long format, as returned by QDate::currentDate().toString().
Expands to the current date and time, formatted as a string according to your locale by QDateTime::currentDateTime().toString().
The current year as a four digit number.
The full name of the current month, according to your locale.
This will expand to a date/time string as defined by FORMATSTRING. FORMATSTRING is a text string, within which the following substitutions will be performed:
Table 8.1. Date formatting entities
h | the hour without a leading zero (0..23 or 1..12 if AM/PM display) |
hh | the hour with a leading zero (00..23 or 01..12 if AM/PM display) |
m | the minute without a leading zero (0..59) |
mm | the minute with a leading zero (00..59) |
s | the second whithout a leading zero (0..59) |
ss | the second whith a leading zero (00..59) |
z | the milliseconds without leading zeroes (0..999) |
zzz | the milliseconds with leading zeroes (000..999) |
AP | use AM/PM display. AP will be replaced by either "AM" or "PM". |
ap | use am/pm display. ap will be replaced by either "am" or "pm". |
d | the day as number without a leading zero (1-31) |
dd | the day as number with a leading zero (01-31) |
ddd | the abbreviated localized day name (e.g. 'Mon'..'Sun'). |
dddd | the long localized day name (e.g. 'Monday'..'Sunday'). |
M | the month as number without a leading zero (1-12) |
MM | the month as number with a leading zero (01-12) |
MMM | the abbreviated localized month name (e.g. 'Jan'..'Dec'). |
MMMM | the long localized month name (e.g. 'January'..'December'). |
YY | The year as a two digit number (00-99). |
YYYY | The year as a four digit number (1752-8000). |
This allows you to control the displayed date very detailled, using common separators between the items, for example: h:m:s ap.
Expands to Your full name, if it can be found. The parser will first try the KDE Email settings from the KDE control center, then the user account information. If a full name can not be found, your user name is filled in.
Expands to your username.
Expands to your email address, if it can be found. The parer will look for it in the KDE Email settings from the KDE control center, and if not found it will use $USER@$HOST instead.
This is your organisation, if present in the KDE Email settings from the KDE control center. If not found, an empty string is returned.
Any other string will be interpreted as an environment variable, and expands to the value of that variable. If the If no variable by that name is set, it expands to "WARNING <VARIBALE> is not set".
The parser looks for a caret character (^) that is not preceeded by a backslash (\) to decide where to position the cursor. If found, it is removed and the cursor is positioned where is was. If more unescaped carets are found, all will be removed, and the position of the last one will be used.
If any escaped caret characters (preceeded by a backslash character) are found, the backslash will be removed.
Prev | Home | Next |
Editing templates | Up | Thanks and Acknowledgments |