Content filter sample 2: keywords plugin

Ian Clatworthy ian.clatworthy at internode.on.net
Tue May 20 06:20:23 BST 2008


Martin Pool wrote:
>>  [*.html]
>>  keywords = escape
>>
>> ``escape`` enables keyword expansion but it escapes special characters
>> in keyword values so they can be safely included in HTML or XML files.
> 
> How about calling it xmlescape as one might want something different
> in C++ or Python source.

That sounds good. I was wondering whether supporting Python's builtin
codec names was a sensible option as well. Would that be viewed as
being powerful? Or overly complex?

>> =====================================================
>>  Now            the current date and time
>>  User           the current user (name and email)
>>  UserEmail      just the email address of the current user
>>  File           the relative path of the file or dir in the tree
>>  FileName       just the name part of the relative path
>>  FileDir        just the directory part of the relative path
>>  =============
> 
> Current _when_?

When the command is run. It's calculated once so all files
output at once will get the same value embedded.

> I guess people are most interested in seeing data about the last
> revision to change the file?  I can see how you might have keywords
> that said when the workingtree was built or by whom but that seems
> less useful.

I completely agree. In RCS terms, Date and Author are the interesting
keywords for most users. That requires a bit of refactoring to
transform.py to hand around the last-changed revision for each file,
so I was starting with a poor man's solution. Think "Date printed"
in Microsoft Word documents. :-)

Ian C.



More information about the bazaar mailing list