This post has two mysteries for me
1. I can't pass the results from a macrocall to a javascript macro into the
set value in the <$button> widget
The macro call returns true rather than the macro result no matter what I
do.
2. The variables that I set using the <$set> widget don't act in the same
way that the global variables like $(storyTiddler)$ and $(currentTiddler)$
act
This works
=========
<$button set="$(storyTiddler)$!!done" setTo=<<addThis>> > text </$button>
[[$(currentTiddler)$ ]]
This doesn't
=========
<$set name="old" value="test">
<$button set="$(storyTiddler)$!!done" setTo=<<addThis>> > text </$button>
[[$(old)$]]
</$set>
Here's the scenario:
I have a macro that removes one string from another
====================================================
exports.run = function(origstring, removestring) {
return origstring.replace(removestring,"");
};
I have a tiddler with fields
====================
title:test
todos: one two three
done: one two
text:
* {{one||templatename}}
* {{two||templatename}}
* {{three||templatename}}
I have a template that creates a button for each value in the [todos -
done] and done fields
====================================================
title: templatename
text:
\define addThis() $(new)$ $(old)$
\define makebutton()
<$list filter="[title[$(storyTiddler)$]field:todos/$(currentTiddler)$/]">
<$tiddler tiddler="$(currentTiddler)$" >
<$list
filter="[title[$(storyTiddler)$]!field:done/$(currentTiddler)$/]">
<$set name="old" value={{$(storyTiddler)$!!done}}>
<$set name="new" value="$(currentTiddler)$">
<$button set="$(storyTiddler)$!!done" setTo=<<addThis>>
>O</$button> [[$(currentTiddler)$ ]]
</$set>
</$set>
</$list>
</$tiddler>
</$list>
<$list filter="[title[$(storyTiddler)$]field:done/$(currentTiddler)$/]">
<$set name="old" value={{$(storyTiddler)$!!done}}>
<$set name="new" value="Test" >
<$tiddler tiddler="$(currentTiddler)$" >
<$button set="$(storyTiddler)$!!done" setTo=<$macrocall
$name="removestring " origstring = "$(old)$" removestring = "$(new)$" /> >
~~ $(currentTiddler)$ ~~ </$button>
<!-- This is where the error is
The macro call sets the field to true rather than to $(old
).replace($(new)$,"")
-->
</$tiddler>
</$set>
</$set>
</$list>
\end
<$macrocall $name="makebutton" />
--
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.
For more options, visit https://groups.google.com/d/optout.