Create New Tiddler contains Wikified Value

65 views
Skip to first unread message

Mohammad

unread,
Aug 5, 2018, 12:39:59 AM8/5/18
to TiddlyWiki
Assume you want to create a tiddler inside it put some wikified values like

<$button>
<$action-createtiddler $basetitle="myTiddler" tags="myTag" text="This is a text based on {{!!title}}"/>
Create
</$button>

Here the the button is in a tiddler titled parent, and the text in the newly created tiddler shall be

This is a text based on parent


Note in the new tiddler we have not {{!!title}} but we have parent

What is the shortest solution, do we need wikify widget?

Mohammad

TonyM

unread,
Aug 5, 2018, 7:37:48 AM8/5/18
to TiddlyWiki
Mohammad,

I understans the {{!!text}} in between the "quotes" along with your text is taken litreraly thus the text reference is not looked up.

If the button was in a macro you may be able to use "some text $moretext$ $(currentTiddler)$"

Or perhaps the new method <<__some var__>> can help but I have not played with that yet.

Regards
Tony

FrD

unread,
Aug 5, 2018, 8:27:30 AM8/5/18
to TiddlyWiki
Hi,

I may have a solution, not sure it's the smallest or the smartest ; and it uses the wikify widget.

\define actions()
<$wikify name=tt text="This is a text based on {{!!title}}">
<$action-createtiddler $basetitle="myTiddler" tags="myTag" text=<<tt>>/>
</
$wikify>
\end

<$button actions=<<actions>>>
Create
</$button>



Regards

FrD

Mohammad

unread,
Aug 5, 2018, 10:20:09 AM8/5/18
to TiddlyWiki
Hello FrD,
 Thank you! your solution works!

Cheers
Mohammad

Eric Shulman

unread,
Aug 5, 2018, 10:22:42 AM8/5/18
to TiddlyWiki
On Sunday, August 5, 2018 at 5:27:30 AM UTC-7, FrD wrote:
I may have a solution, not sure it's the smallest or the smartest ; and it uses the wikify widget.
\define actions()
<$wikify name=tt text="This is a text based on {{!!title}}">
<$action-createtiddler $basetitle="myTiddler" tags="myTag" text=<<tt>>/>
</
$wikify>
\end

<$button actions=<<actions>>>
Create
</$button>

In this particular use case, since the reference is to the current tiddler title, you can use the "currentTiddler" variable, rather than having to transclude the title field of the tiddler.... and, since the actions are defined in a macro, you can use the $(currentTiddler)$ *macro substitution" syntax to insert the actual title text.  Something like this:

\define actions()
<$action-createtiddler $basetitle="myTiddler" tags="myTag" text="This is a text based on $(currentTiddler)$"/>

\end
<$button actions=<<actions>>>Create</$button>

enjoy,
-e


Mohammad

unread,
Aug 5, 2018, 10:41:25 AM8/5/18
to TiddlyWiki
Many Thanks Eric!
Now I can have a smaller and cleaner code!
Mohammad

FrD

unread,
Aug 5, 2018, 10:54:12 AM8/5/18
to TiddlyWiki
Hi Eric,

Short and efficient !!!
Thanks for the tip.

Regards

FrD
Reply all
Reply to author
Forward
0 new messages