[TW5] Transclude Text

139 views
Skip to first unread message

TonyM

unread,
May 3, 2018, 7:59:18 AM5/3/18
to tiddl...@googlegroups.com
Folks,

I have a button to create tiddlers while copying the text field from a source tiddler.

  • I have the source tiddler name in the variable <<sourcetiddlers>>
  • I have the new tiddler name in the variable <<newtiddlers>>

I can not identify how to specify ###here### the value in <<sourcetiddlers>> text field.

<$button>
<$action-createtiddler $basetitle=<
<newtiddlers>> tags={{$:/temp/newtemplatetags}} text=###here###/>
Copy </$button>

I have tried set and macros with no luck so far.

Any help would be appreciated.

Regards
Tony

Xavier Cazin

unread,
May 3, 2018, 9:52:54 AM5/3/18
to tiddl...@googlegroups.com
Hi Tony,

Most often, this the action widget itself that needs to be wrapped in a macro, so that it can reference variables through the $v$ or $(v)$ mecanism, as in:

\define foo2bar()
<$button>
<$action-createtiddler
   $basetitle="$(newtiddler)$"
   tags={{$:/temp/newtemplatetags}}
   text={{$(sourcetiddler)$!!text}} />
</$button>
Copy
\end

<$vars sourcetiddler=foo newtiddler=bar>
<<foo2bar>>
</$vars>

Regards,
Xavier.

-- Xavier Cazin

--
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 tiddlywiki+unsubscribe@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
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/3fe10a21-6d00-4647-ac0d-94452d64bc16%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Xavier Cazin

unread,
May 3, 2018, 9:55:48 AM5/3/18
to tiddl...@googlegroups.com
Tony,

Sorry I meant to have the Copy string inside the button widget of course:

\define foo2bar()
<$button>
<$action-createtiddler
   $basetitle="$(newtiddler)$"
   tags={{$:/temp/newtemplatetags}}
   text={{$(sourcetiddler)$!!text}} />
Copy
</$button>
\end

<$vars newtiddler=bar sourcetiddler=foo>
<<foo2bar>>
</$vars>


Cheers,
Xavier.

-- Xavier Cazin

TonyM

unread,
May 3, 2018, 9:54:59 PM5/3/18
to TiddlyWiki
Thanks xavier,

What you suggest makes sense, I will have a go when at my computer.

I still wonder why we must go to such lengths to simply use a parameter or why we must in the first place. It takes time to learn the convoluted way is the only way. Surely we could introduce another widget or variable reference so we can use the intuitive code patterns?

It feels like I am beating my head against a brick wall, or is making the same mistake time and again is a sign of madness.

Thanks
Tony

Xavier Cazin

unread,
May 4, 2018, 5:28:13 AM5/4/18
to tiddl...@googlegroups.com
Hi Tony,

I still wonder why we must go to such lengths to simply use a parameter or why we must in the first place. It takes time to learn the convoluted way is the only way. Surely we could introduce another widget or variable reference so we can use the intuitive code patterns?

Evan Balster has been working on an extension of his "mushroom" operator that would allow in-place wikification of widget parameters (see http://evanbalster.com/tiddlywiki/formulas.html#Formulas%20as%20Tag%20Attributes). That would certainly ease the use of widgets. But don't hold your breath: merging this addition into the core would not be a simple move...

Best,
-- Xavier Cazin

TonyM

unread,
May 4, 2018, 6:11:15 AM5/4/18
to TiddlyWiki
Xavier

I thought it was html arguments, not widgets. Thats good to know.

I am not sure how long it will take but evan seems quite persuasive and is contributing to tiddlywiki performance improvements.

Thanks
Tony

Mark S.

unread,
May 4, 2018, 10:48:28 AM5/4/18
to TiddlyWiki
This test code:

<$vars newtiddlers="MyNewTiddler">
<$button>
<$action-createtiddler $basetitle=<
<newtiddlers>> tags={{$:/temp/newtemplatetags}} text=###here###/>
Copy </$button>
</$vars>

seems to work fine. Be aware that action-createtiddler doesn't open the tiddlers it makes. They appear in the Recent tab. You can use the $savetiddler feature if you want the tiddler to be opened as well as created.

-- Mark
Reply all
Reply to author
Forward
0 new messages