As you can see the wrapper isn't need - actual when the module is compiled
its source gets copied inside a wrapper ...
$:/tags/Macro is used for wikitext macros, js marcos have an extra field
'modules-type' set to 'macro'.
all js tiddlers need a 'modules-type' otherwise they will not get compiled.
In the case of your 'shared.js' it needs 'modules-type' but leave the
value blank.
all the best
BJ
On Friday, March 3, 2017 at 12:10:51 PM UTC+1, tejjyid wrote:
>
> I have a couple more questions if you have time:
>
> 1.) I notice your macro isn't wraped in a (function(){...} structure and
> was wondering why? I also noticed that there was no $:/tags/Macro tag, but
> I've noticed that doesn't seem fundamental on my own macros.
>
> 2.) I slavishly copied your structure, changing only the names (I thought)
> but for reasons obscure to me my "shared.js" tiddler, which is supposed to
> be identical to your "commondefs" tiddler, isn't found by the require
> statement. I've attached them in case you feel like tracking down my error.
> So far as I can tell the tagging, tiddler type & fields are the same, but
> it's late here....
>
> Thanks in anticipation (but it's unreasonable, sure, I understand that)
>
>
>
> On Wednesday, 1 March 2017 03:36:36 UTC+11, BJ wrote:
>>
>>
>> I have had a quick hack to indicate what I think may be the best approach
>> - see attached,
>>
>> all the best
>> BJ
>>
>>
>> On Tuesday, February 28, 2017 at 12:04:57 PM UTC+1, tejjyid wrote:
>>>
>>> I've managed to update many of my simpler macros, but now I'm moving on
>>> to the more complicated ones.
>>>
>>> There are two scenarios that I used to have:
>>>
>>> 1.) a list of words stored in one tiddler that I would highlight in a
>>> range of texts stored in other tiddlers. That list of words would be
>>> converted into a regex via some inline js, and I could then use that regex
>>> in other macros, because once created the regex variable was "visible"
>>> everywhere. From my point of view, this was an easy option because I could
>>> update the list of words to be annotated easily.
>>>
>>> 2.) I had a library of functions stored in one tiddler that I could use
>>> in varying combinations in different macros.
>>>
>>> I can't work out to do either thing in the TW5 framework. I don't mind
>>> doing it a better way, if the better way doesn't involve complex code. Or
>>> alternatively, how do I make the same arrangement work?
>>>
>>> Something else - I used to be able to get tiddlers into my macros with
>>> code like "store.getTiddlerText" - does that functionality still exist? Can
>>> someone point me to where it's documented?
>>>
>>> If anyone feels they need to look at old code to answer the questions:
>>> the attached has everything. But probably some ideas on how to do it &
>>> pointers to useful documentation would be enough.
>>>
>>> Thanks
>>>
>>
--
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/9185775e-ad4c-44be-a2ff-0967277dbaca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.