I not sure how to achieve THIS substitution ... ??

73 views
Skip to first unread message

@TiddlyTweeter

unread,
Feb 2, 2019, 3:10:34 PM2/2/19
to TiddlyWiki
I simply don't understand how to get the plain string "that" (via user input) established & working so it can replace "THIS" in the following...

\define that() ??? How?

<$button>
<$action-sendmessage $message="tm-new-tiddler" $param="$:/long/address/to/tiddler/THIS" tags="searcher" caption="THIS"  text={{$:/some/tiddler}}/>
Click me!
</$button>

Any clues would be appreciated.

Best wishes
Josiah

@TiddlyTweeter

unread,
Feb 2, 2019, 3:11:16 PM2/2/19
to TiddlyWiki
Repeat for email ...

Eric Shulman

unread,
Feb 2, 2019, 4:26:05 PM2/2/19
to TiddlyWiki
On Saturday, February 2, 2019 at 12:10:34 PM UTC-8, @TiddlyTweeter wrote:
I simply don't understand how to get the plain string "that" (via user input) established & working so it can replace "THIS" in the following...

\define that() ??? How?

<$button>
<$action-sendmessage $message="tm-new-tiddler" $param="$:/long/address/to/tiddler/THIS" tags="searcher" caption="THIS"  text={{$:/some/tiddler}}/>
Click me!
</$button>


This should do what you want:
<$edit-text tag="input" tiddler="$:/temp/getname" default="" />
<$button> Click me!
   <$wikify name="target" text="$:/long/address/to/tiddler/{{$:/temp/getname}}">
      <$action-sendmessage $message="tm-new-tiddler" $param=<<target>>
         tags="searcher" caption={{$:/temp/getname}} text={{$:/some/tiddler}}/>
   </$wikify>
</$button>

1) an $edit-text widget gets the user input and puts it in a temporary tiddler "$:/temp/getname"
2) the $wikify widget is used to combine static text with the value from the temporary tiddler
3) the value of the resulting "target" variable is used as the $param for the new tiddler title
4) the value from the temporary tiddler is also used as the caption text for the new tiddler

Q.E.D

enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!" (tm)
InsideTiddlyWiki: The Missing Manuals

 

@TiddlyTweeter

unread,
Feb 2, 2019, 6:17:00 PM2/2/19
to TiddlyWiki
Thank you Eric for clear code and a very useful explanation!

I have it working in my TW.

Best wishes
Josiah

Eric Shulman wrote:

This should do what you want:
<$edit-text tag="input" tiddler="$:/temp/getname" default="" />
<$button> Click me!
   <$wikify name="target" text="$:/long/address/to/tiddler/{{$:/temp/getname}}">
      <$action-sendmessage $message="tm-new-tiddler" $param=<<target>>
         tags="searcher" caption={{$:/temp/getname}} text={{$:/some/tiddler}}/>
   </$wikify>
</$button>

1) an $edit-text widget gets the user input and puts it in a temporary tiddler "$:/temp/getname"
2) the $wikify widget is used to combine static text with the value from the temporary tiddler
3) the value of the resulting "target" variable is used as the $param for the new tiddler title
4) the value from the temporary tiddler is also used as the caption text for the new tiddler

Q.E.D. 

TonyM

unread,
Feb 2, 2019, 6:53:32 PM2/2/19
to TiddlyWiki
Eric/Jeremy,

If you could help me just clarify something here.

The Wikify is in effect "evaluating" the text="$:/long/address/to/tiddler/{{$:/temp/getname}}" into our new tiddler name.

This is why most people use wikify, to evaluate the values in transcludes, text references etc.. into a value string.

If I understand correctly the result is not only evaluated, but prepared for display? Like turning [[tiddlername]] into a wiki link. As a result using what is returned, is not always valid in a subsequent use, and the use of the text widget is sometimes required or supposedly the wikify $output=text can be used. I understand this is not the case in the example shared in this thread, because you can use $param=<<target>>.

Can you possible throw a little light on this? I am in an investigative phase to understand and document some quirks here in user perception vs tiddlywiki methods.

I am researching in relation to the following github issue I raised 

Propose new Widget textify? #3730  


Regards
Tony
Reply all
Reply to author
Forward
0 new messages