Hi,

strange then. Here is what I get when I try to save a tiddler that calls 
your macro - before removing str() - right in the middle of the screen:


But as long as it works now just a strange occurrence, glad that I could 
help.


On Thursday, 15 October 2020 06:30:45 UTC+2, Shareda wrote:
>
> Felicia, Yes, I've reloaded wiki after saving/importing the macro. But 
> there was no error message or I just don't know where(?) to look for it. 
> Anyway, I removed str(), and macros is ok now! So thank you! I did not know 
> about that error! Now I remove $:/tags/Macro..
>
> четверг, 15 октября 2020 г. в 03:45:54 UTC+6, Felicia Crow: 
>
>> Hi,
>>
>> first question since it is a javascript macro: Have you reloaded your 
>> wiki after saving/importing the macro? Unlike wiki text macros javascript 
>> macros only get loaded in when the wiki itself is loaded.
>> The reason I am asking is because when I try to call your plugin after a 
>> reload it gives me a very clear error message of what is wrong: str is not 
>> defined.
>> Seeing how the input is already a string converting it to one - which I 
>> assume is what you wish to do - is not necessary. So if you just remove 
>> str() around each regexp you should be able to call your macro without 
>> problems.
>>
>> Also as an aside: Javascript macros are global by default and don't need 
>> to be tagged with $:/tags/Macro.
>>
>> Hope this helps.
>> Felicia
>>
>>
>>
>> On Wednesday, 14 October 2020 20:52:40 UTC+2, Shareda wrote:
>>>
>>> Hello! What is wrong? I don't understand how to find out this and debug.
>>>
>>> 1. I created my macros tiddler;
>>> 2.  Added   $:/tags/Macro  tag;
>>> 3. Try to use these ways. It results just nothing.
>>>   3.a. <<validateregexp "this||or that|">>
>>>   3.b. <$macrocall $name="validateregexp" text="Text to be made into 
>>> italics"/>
>>> 4. checked <<dumpvariables>>. There is no my macros...
>>> Here is my macro exportred:
>>>
>>> module-type: macro
>>> tags: $:/tags/Macro
>>> title: $:/hyperbook/validateregexp.js
>>> type: application/javascript
>>>
>>> /*\
>>> title: $:/hyperbook/validateregexp.js
>>> type: application/javascript
>>> module-type: macro
>>>
>>> Macro to return a clean regexp that does not hang-up the whole wiki and 
>>> does not get out-of-memory 
>>>
>>> \*/
>>> (function(){
>>>
>>> /*jslint node: true, browser: true */
>>> /*global $tw: false */
>>> "use strict";
>>>
>>> /*
>>> Information about this macro
>>> */
>>>
>>> exports.name = "validateregexp";
>>>
>>> exports.params = [
>>>     {name: "regexp"}];
>>>
>>> /*
>>> Run the macro
>>> */
>>> exports.run = function(regexp) {    
>>>     regexp= str(regexp).replace(/([\|\\\{\}]){2,}/g, "$1");
>>>     regexp= str(regexp).replace(/^([\|]){1,}/g, "");
>>>     regexp= str(regexp).replace(/([\|]){1,}$/g, "");
>>>     return regexp;
>>>     // if(!baseName) {
>>> // baseName = $tw.language.getString("DefaultNewTiddlerTitle");
>>> // }
>>> // return this.wiki.generateNewTitle(baseName, options);
>>> };
>>>
>>> })(); 
>>>
>>>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/8c8703fb-f312-41be-a139-c6c986afea9ao%40googlegroups.com.

Reply via email to