On Tuesday, June 8, 2021 at 8:21:19 PM UTC-7 [email protected] wrote:
> There are often many different ways of doing things, and I just went ahead
> with the fastest solution I could think of...
>
Here's a much more compact way to write the same functionality:
\define temp() $:/temp/input/$(currentTiddler)$
| Label:|<$edit-text tiddler=<<temp>> field="label"/> |
| From Tag:|<$edit-text tiddler=<<temp>> field="fromtag"/> |
| Target:|<$edit-text tiddler=<<temp>> field="target"/> |
| Target Tag:|<$edit-text tiddler=<<temp>> field="targettag"/>|
<$tiddler tiddler=<<temp>>>
<$button> <$view field="label">join tiddlers</$view>
<$action-setfield $tiddler={{!!target}} text={{{
[tag{!!fromtag}get[text]join[]] }}} tags={{!!targettag}} />
<$action-deletetiddler tiddler=<<temp>> />
</$button>
</$tiddler>
Notes:
1) the inputs are stored in a $:/temp tiddler, so it doesn't clutter up the
visible list of tiddlers
2) the temp tiddler's title is assembled using a simple \define, rather
than using $vars with filtered transclusion syntax
3) the input form uses simple wikitext table syntax instead of HTML syntax
to produce more readable code
4) the $edit-text widgets target <<temp>> rather than the more verbose, but
equivalent, {{{ [<temp>] }}}
5) the $button is enclosed in a $tiddler widget so that references to the
input field values can use {{!!fieldname}}
6) the $button uses <$view>...</$view> to provide a default label if none
is input
7) instead of using $wikify, the output text is constructed using filtered
transclusion syntax to join the source tiddler content into a single string
8) the $:/temp tiddler is deleted after processing the $button press to
clear all the form inputs for re-use
enjoy,
-e
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/218d0f02-a4f4-4deb-b259-60e4767b1460n%40googlegroups.com.