On Sun, Jan 24, 2021 at 05:48:10AM -0800, Misterel85 wrote:
> So, here's what I would like:
>
> 1. I create an activity tiddler.
> 2. I create the corresponding generic source tag tiddler(s) if they
> don't already exist. Ex. a tiddler tag whose text field holds info about a
> (hypothetical) '
dramatis.com' website would be called 'dramatis' and tagged
> 'Source'.
> 3. For every time I add a source tag to the activity tiddler, TW checks
> whether a corresponding source detail field exists in that current activity
> tiddler.
> 4. If not, it retrieves the name of the tag and creates a new field
> named after that tag. In the example above, a corresponding field named
> 'dramatis_detail' or simply 'dramatis' would be added in the current
> activity tiddler.
> 5. If I delete a source tag (ex. the 'dramatis' tag), the corresponding
> 'dramatis' field would also be deleted. (That step may not be necessary if
> step 3 is implemented.)
The following tiddler + setup should:
* add a "Sources" field which will show up whenever you edit a
tiddler, where you will be able to search/select tags, just like the
regular tag interface; it should show up at the bottom of a tiddler
when editing it.
* When selecting a tag *there*, it will be added to the current
tiddler, AND, a new field called "<tag> detail" will be added, if
the tag itself is tagged with the "source" tag.
NOTE: it will only work with tiddlywiki 5.1.23 (latest release as of
today), since it depends on some new features of the "tag-picker"
macro.
To add it to your tiddlywiki, create a new tiddler, as follows:
title: doesn't matter, name it as you wish
tags: $:/tags/EditTemplate
content: (omit the % START % / % END % markers below)
%%%%%%%%%%%%%%%%%%%%%%%% START %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\define acts()
<$list filter="[<tag>tag[source]]">
<$action-setfield $tiddler="$(currentTiddler)$" $value="FILLME" $field={{{ [<tag>addsuffix[ details]] }}} />
</$list>
\end
Sources: <$macrocall $name="tag-picker" actions=<<acts>> />
%%%%%%%%%%%%%%%%%%%%%%%% END %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
If the above provides what you need, you should then consider using that
code to replace the original tags widget in the edit tiddler interface. To do
that, I would:
* save and backup my wiki ;)
* copy-paste the original tiddler (its title is
$:/core/ui/EditTemplate/tags ), into this new tiddler you created.
* integrate the "acts" macro, and the changes to the "tag-picker"
macrocall that I suggested above, to the copy-pasted tiddler content.
* put the tiddler in the proper place in the edit interface: Click on
the tag-pill for the $:/tags/EditTemplate of the new tiddler, and
drag-and-drop the new tiddler's title to the desired position
* Edit the $:/core/ui/EditTemplate/tags tiddler, to remove the
$:/tags/EditTemplate tag from it, so it doesn't show up in the edit
interface anymore.
* Enjoy the new setup!
Cheers,
--
Javier