using editor variables in code templates

Are you missing a feature? Request its implementation here.
matthew.stephens
Posts: 3
Joined: Wed Jun 03, 2009 11:35 pm

using editor variables in code templates

Post by matthew.stephens »

I would like to write code templates that paste in some of the editor variables that are so useful in validation and transformation scenarios. If something more than ${caret} could be used, the templates become a lot more flexible.

Thanks for making such a great product, by the way!

Matthew Stephens
University of Virginia Library
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: using editor variables in code templates

Post by sorin_ristache »

Hello,

The editor variables are generic placeholders for environment details that are useful in actions applied to XML documents. Do these environment details have a place in the content of the edited XML document? Can you give examples?


Thank you,
Sorin
matthew.stephens
Posts: 3
Joined: Wed Jun 03, 2009 11:35 pm

Re: using editor variables in code templates

Post by matthew.stephens »

Here's an example of how editor variables might be used in an XML document. You might have unique identifiers that you wish to add to a <milestone> element in a file, and you would build a code template to construct the element tag and its accompanying id attribute. If you wanted to prefix each id number with the file's name (to create unique IDs across a collection of files), you would want this in your template:

Code: Select all

<milestone id="${cfn}${caret}" unit="chapter"/>
If that template existed, you could type a key and get the element in your XML file, with the filename already added as part of the attribute value, with the cursor (or caret) in place to add more text to that value.

Given the kinds of markup we do here at UVA Library, that would be a great time-saver.

M.S.
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: using editor variables in code templates

Post by sorin_ristache »

It sounds like a good candidate for a custom Author action that would be called by pressing a toolbar button in Author mode. Author actions are developed using the Author SDK that is available on the Developer page. The action is developed once, plugged to a document type and used by all the content authors who edit XML documents of the same type.


Regards,
Sorin
Post Reply