Executing Macro via Template Trigger ?

Post any comments, suggestions, annoyances or ideas for future releases here. Please do not post bug reports or questions here.
Post Reply
amix
Posts: 49
Joined: Wed Aug 22, 2007 1:26 pm

Executing Macro via Template Trigger ?

Post by amix »

Hi,

sometimes I'd like to launch a script, that parses text from the current line, takes this as arguments for a script. The script than inserts text into the editor, replacing certain placeholders with the argument.
I could do this as a macro and give it some hotkey, sure, but I'd prefer the macro to act as an 'intelligent' template of some sorts.

Here is an example:
I want to create the documentation-header for a class. As soon I enter

Code: Select all

cdoc
a script gets launched, that searches the currently opened text for certain patterns (here it would be '@namespace foo.bar'), extracts 'foo.bar' and adds it to the '@memberOf' part in the header, constructing a header with a part, that reads '@memberOf foo.bar'.

A full example may look like this:

Code: Select all

/** "public" method 
* @method
* @memberOf YAHOO.myProject.myModule
* @param {Type[, Type, ... ]} [Parameter |...] Parameter-Description
* @return {Type [, Type, ...]} Returns-Description
* @type Object
This documents a Javascript object. Now there is possibilities, to create such an object, that takes arguments and such, that don't.
If, in the editor I'd invoke this as a template like this:

Code: Select all

cdoc param description, param2 description, param3 description, [param4 description]
.Zeus would find the 'cdoc' string, realize it as template-trigger, execute the associated script with all, that is behind the template-trigger as argument. The macro would automatically realize, that the script-doc header needs a '@param' attribute and would also add the parameter-template as I described it.
amix
Posts: 49
Joined: Wed Aug 22, 2007 1:26 pm

Post by amix »

Oops, as I just saw in: http://www.zeusedit.com/forum/viewtopic.php?t=1002 it is there in the new version. Sorry.
Post Reply