Trees | Indices | Help |
|
---|
|
Provide functionality for code templates uses.
All templates saved into directory "./templates". You may save you templates in other dirictory that you like and add they paths into configuration file.
Conventions for templates name: typ_name.py, whereFunction's definition for template must like: "def
???_*(fields):
", where "fields" - dict
(for user enter values for fields), "???" - type of
template, "*" - name of template.
Function's definition for keywords must like: "def
kwd_*():
", where "*" - name of
keyword.
If function preffix is other or absent then this function is not interpreted as template or keyword.
Functions must return string or other objet which may be converted
to string by operator str()
. From returned string will be
removed first and last newline characters. vIf returned string is empty
then no result applying to source code.
First time template functions calls to get template for display user preview of you template, and pass empty fields=={}. You may change value of fields to take caller information about fields. If you do not change fields, then for fields value will be assigne it's names. Second time template-function will be called with entered fields dict as argument and you may use fields values that user entered or assigned by default. All fields are case insensitive, then parsing returned template.
String "# Your code" place into position for user input. All template's functions may have next attributes or other:# language = python # category = Python # author = Mazhugin Aleksey
Predefined and known by pluggin in
./boa-pluggins/CodeTemplates.plug-in.py
metainfonames is
language and category.
For retrive source file path you must use
codetpl_sourcefile
global variable which auto appending
into module dictionary.
If error occurs you may rise exception or return error description into template string. If you rise exception then exception type and text will be writed instead template.
Loads all finded and right files. Last templates override previous with same names.
|
|||
|
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Mon Dec 1 23:43:15 2008 | http://epydoc.sourceforge.net |