[Eric] Patch for predefined template variables

Dan Bullok dan.eric at bullok.com
Thu Jul 24 20:26:12 BST 2008


I'm attaching a patch to eric4-4.2-snapshot-20080719 that implements 
predefined variables in templates.  Predefined variables are automatically 
computed - the user does not have to enter them in the template dialog.  
I've found it very useful.  If there's interest, I'd be happy to expand on 
this feature (make it easy for user's to define their own predefined vars).

The following variables are defined:
	$date$ 	Today's date in iso format
	$year$	The current year
	$project_name$	The name of the project (if any)

The following variables represent different parts of the current file's name.  
As an example, consider the file  "/home/bob/test.py"
	$path_name$	The full path name: "/home/bob/test.py"
	$dir_name$	The parent directory: "/home/bob"
	$file_name$	The file name: "test.py"
	$base_name$	The base name: "test"
	$ext$		The extension: "py"

-Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: eric4-4.2-snapshot-20080719--predefined-template-variables.patch
Type: text/x-diff
Size: 2814 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/eric/attachments/20080724/41dc52d0/eric4-4.2-snapshot-20080719--predefined-template-variables.bin


More information about the Eric mailing list