Ah, I see what you mean.

Don't forget that macros are in fact implemented as variables. So a global
macro is in fact a global variable.

But I'm not sure that this is a good use of variables. You're replacing the
need to remember a tiddler title with the need to remember a variable name.
I think it's clearer to use the full tiddler title; that way you'll find
the reference with search and replace, for instance.

Best wishes

Jeremy




On Wed, Nov 26, 2014 at 9:11 AM, Danielo Rodríguez <[email protected]>
wrote:

> Hello Jeremy,
>
> For the "code" part I'm using a library module holding all the constants
> inside a config object. But I will think about your proposal
>
> I was talking about variables to be used within wiki-text. Sorry for not
> be clear
>
> El miércoles, 26 de noviembre de 2014 09:53:04 UTC+1, Jeremy Ruston
> escribió:
>>
>> Hi Danielo
>>
>> If your plugin needs to create global variables you should do so in the
>> $tw namespace. For example:
>>
>> $tw.plugins.danielo515.mysuperplugin.MY_CONSTANT
>>
>> You'd create the global with something like this:
>>
>> $tw = $tw.plugins || {};
>> $tw.plugins.danielo515 = $tw.plugins.danielo515 || {};
>> $tw.plugins.danielo515.mysuperplugin = $tw.plugins.danielo515.mysuperplugin
>> || {};
>> $tw.plugins.danielo515.mysuperplugin.MY_CONSTANT =
>> "$:/mycomplicatedtiddlertitle"
>>
>> Best wishes
>>
>> Jeremy.
>>
>>
>>
>> On Wed, Nov 26, 2014 at 8:41 AM, Danielo Rodríguez <[email protected]>
>> wrote:
>>
>>> Hello,
>>>
>>> I was thinking that is horrible while developing a plugin to remember
>>> all the tiddler names and remember where do you use them. If you have to
>>> change one (because I'm horrible giving names) you have to change it in all
>>> the places where the plugin uses it and you have to remember that new name.
>>> This will be easier defining global variables. This way you only write it
>>> once, and change as many times as you want. You can even create test
>>> tiddlers, change the variable value to the new tiddler, and voilá! test
>>> ready.
>>>
>>> I think this is possible using global macros, but, is there any better
>>> solution?
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "TiddlyWiki" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at http://groups.google.com/group/tiddlywiki.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>> Jeremy Ruston
>> mailto:[email protected]
>>
>


-- 
Jeremy Ruston
mailto:[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to