Deb Lewis
2006-Jun-03 16:08 UTC
[Masterview-devel] Comment template substitution fields proposal
Don''t quite like the way the current generated-comment mechanism works. Right now, the source template file name is bolted onto the end of whatever generated-comment template is defined, whether you want it or not, and whether that''s where you''d like it presented or not. Proposal: allow substitution fields in the comment template so users can make the comment look any way they like. Source template name isn''t required, though certainly recommended, and now it can be positioned whereever desired, not just on the last line of the generated comment. Support "template_path" reference as a standard substitution target for the full pathname of the template source file. Maybe also consider additional substitution vars to support: template_rel_path - relative pathname of the template file in the template source dir ??template_timestamp - last-changed timestamp of the template file ??timestamp - timestamp of the generated file Some sample variations and notation alternatives: - notation style 1: Ruby variable string substitution notation: # DO NOT EDIT - generated by MasterView from: # #{template_path} # Changes made to this file will be lost when it is re-generated. - notation style 2: erb notation: # -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- # DO NOT EDIT - generated by MasterView from: # <%= template_path %> # -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- I have a working implementation using the first approach #{template_path}. Note that you do have to be a bit careful about the string literals you use in this approach so that the variable substitution isn''t evaluated while you''re defining the template itself. But it''s a bit more concise and readable to my eye that the erb style. What''s your preference? Shouldn''t be hard to change if you''d rather go with the erb-style notation. ~ Deb