[TxMt] Set temporary variables within macro

Richard Blumberg richard at rnet.org
Mon Nov 19 17:44:58 UTC 2007


I'm trying to build a complicated macro to add a footnote to text selected in
a document. There are two values that I need to maintain while the macro
runs, so that those values can be inserted into the proper places within the
links that the macro creates. The values are CURRENT_FN_NUMBER, a unique id
I create with the shell date command; and CURRENT_FN_TITLE, which is the
value of $TM_SELECTED_TEXT when the macro launches. 

I'd like to us those values to insert code into the document, e.g. 

  * At the beginning of the current paragraph: <a
name="{$CURRENT_FN_NUMBER}"></a>

  * Replace selected text with: <a
href="#fn{$CURRENT_FN_NUMBER}">$CURRENT_FN_TITLE</a>

  * At bottom of document, just before "<!--<next footnote -->": <a
name="fn{$CURRENT_FN_NUMBER}"
href="#{$CURRENT_FN_NUMBER}">$CURRENT_FN_TITLE</a>

There's more to it than that (setting div and span tags, adding class
attributes, etc.), but you get the idea. The macro does a lot of jumping
around within the document, setting and removing bookmarks as it goes. 

I've created CURRENT_FN_NUMBER and CURRENT_FN_TITLE as project environmental
variables, but I can't figure out how to set values for those variables when
the macro executes. 

I'm (obviously) new at this game; I'd appreciate help. 

Thanks. 

Richard


-- 
View this message in context: http://www.nabble.com/Set-temporary-variables-within-macro-tf4838075.html#a13841243
Sent from the textmate users mailing list archive at Nabble.com.




More information about the textmate mailing list