Did you try my approach? I see you're still trying to pass a macro with
parameters inside a widget. I've never gotten that to work.
What is the code trying to do? I think it's making a unique list of words
as an index, but I'm not sure. Do you know for sure that that part of the
code works?
Good luck,
Mark
On Thursday, March 10, 2016 at 10:57:33 PM UTC-8, Andrew wrote:
>
> Regrettably I still can't seem to accomplish what I want:
> I got the following to pass the current tiddler title to the macro:
>
> <$vars arg=<<currentTiddler>> tmp=<<reduce title:$(arg)$>>>
> <$button class="tc-btn-invisible">
> <$action-sendmessage
> $message="tm-edit-text-operation"
> $param="replace-all"
> text=<<tmp>>
> />
> {{$:/plugin/ajh/reduce/image}}
> </$button>
> </$vars>
>
> but I think what I want is to either pass the current text field to the
> macro or somehow get the macro to pull the text field information before
> manipulating and returning the reduced text. This seems impossible. Maybe
> I'm looking at this all wrong. I wish there was a <<currentText>> or
> something. All I want to do is the following:
>
> var text = $tw.wiki.getTiddlerText(title);
> var zwrds = text.toLowerCase().replace( /\W/g," ");
> var ztrc = zwrds.split(" ").sort().reverse();
> var zntrc = " ";
> var add = "";
> for (var i = 0; i < ztrc.length; i++) {
> if (zntrc.indexOf(ztrc[i]) < 1) {
> add = ztrc[i].toString();
> zntrc += add;
> }
> }
> var t= zntrc.slice(1);
> return t;
>
>
> On Thu, Mar 10, 2016 at 4:11 AM, Mat <[email protected] <javascript:>>
> wrote:
>
>> I'm pretty sure that this bit won't work:
>>>
>>> text=<<reduce "$(mytext)$">>
>>>
>>>
>>
>> I just recently did a lot of experimenting and (1) assuming that the
>> above in deed is the problem, and (2) that I don't misunderstand the issue
>> then FWIW here's a setup that I do get to work. The idea is to externalize
>> the invocation with a $set and then, inside the widget, call the "name" of
>> the set variable instead. Please tell me if I'm missing the point/issue
>> when suggesting this.
>>
>> Example:
>>
>> title:Foo
>> test: (blank)
>>
>> \define foo() This is $(arg)$
>>
>> <$set name="arg" value="myarg">
>> <$set name="tmp" value=<<foo>>>
>> <$button>
>> <$action-setfield
>> $tiddler="Foo"
>> test=<<tmp>>
>> />
>> Click
>> </$button>
>> </$set>
>> </$set>
>>
>> test = {{!!test}}
>>
>>
>> <:-)
>>
>> --
>> 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] <javascript:>.
>> To post to this group, send email to [email protected]
>> <javascript:>.
>> 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/f1743db2-8d22-494a-950c-e91bf062fd56%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/tiddlywiki/f1743db2-8d22-494a-950c-e91bf062fd56%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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/7a6da865-999a-4336-8da9-6bbc2fe0d1bf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.