Hi Danielo
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.
>
A reasonable approach might be to have a daemon (ie startup module) that
performs the calculations in response to a message, and deposits the
results in a tiddler.
Best wishes
Jeremy.
>
> 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].
> 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/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.
>
--
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.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/CAPKKYJa0EQdezHwt00%2BqduhdD3J0pRD4t_93XjQwRzJfkJC3ZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.