Also interesting for you may be this topic:

https://groups.google.com/d/topic/tiddlywiki/V18SC8SDNOw/discussion

And Jeremy's comment:

https://groups.google.com/d/msg/tiddlywiki/V18SC8SDNOw/moR6BNo8kCEJ

On 07.04.2015 18:16, Danielo Rodríguez wrote:
> Hello everyone.
>
> I want to build a batch text processing tool on top of TW5. The first
> tool I have "implemented" is a column compare one. It is a macro that
> gets the text on two tiddlers and give you the unique values in one
> side of the comparison. The problem with  using a macro is that it is
> evaluated on every keystroke, navigation event and so on. This is
> extremely slow and unefficent. Which kind of element should I use to
> make this more usable? A widget? if so, how? I would like to process
> just once and then show the result.
>
> This is what I have currently:
>
> |
> /*\
> title: $:/macros/danielo515/get_unique_values.js
> type: application/javascript
> module-type: macro
>
> This macro returns the list of values that exists only on tiddler A.
> It expects a list of \n separated values on each tiddler.
>
> \*/
> (function(){
>
>   /*jslint node: true, browser: true */
>   /*global $tw: false */
>   "use strict";
>
>   /*
>   Information about this macro
>   */
>
>   exports.name = "getunique";
>
>   exports.params = [
>   {name: "A"},
>   {name: "B"}
>   ];
>
>   /*
>   Run the macro
>   */
>   exports.run = function(A,B){
>     var a=($tw.wiki.getTiddlerText(A) ||""),
>         b=($tw.wiki.getTiddlerText(B) ||""),
>         a_values= a.split('\n'),
>         b_values= b.split('\n'),
>         result = [];
>         
>         a_values.forEach(function(a_value){
>             if(b_values.indexOf(a_value) === -1)
>                 result.push(a_value);
>         });
>         console.log(result.length," unique values remains");
>         return "```\n" + result.join('\n') + "\n```";
>   };
>
> })();
> |
>
>
> -- 
> 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]
> <mailto:[email protected]>.
> To post to this group, send email to [email protected]
> <mailto:[email protected]>.
> Visit this group at http://groups.google.com/group/tiddlywiki.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tiddlywiki/dc66884b-c46a-4664-bbe3-0ae8dd3fcc4f%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/dc66884b-c46a-4664-bbe3-0ae8dd3fcc4f%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/BLU436-SMTP122257C6C3C4CCBFDFD5A21CEFD0%40phx.gbl.
For more options, visit https://groups.google.com/d/optout.

Reply via email to