My initial request was asking for a more automated way to replace one specific reference to the name of the data tiddler being used (my-dtid) in the tiddler named A Dictionary Project once I had cloned the tiddler multiple times.
I didn’t realise at the time that this could be achieved using @Mohammad’s wonderful Tiddler Commander plugin. Maybe other knowledgeable users didn’t answer for that reason.
Tiddler Commander can create multiple copies that can then be changed by using a tag filter or title.
That said a means to globally search for tiddlers and subsequently changed any text within them simultaneously would be my solution, perhaps a procedure/macro. (not sure if this can or has been done).
A Tutorial / Example for beginners would be helpful.
The text of the tiddler, A Dictionary Project shown below for reference.
\define thisListMacro()
<b><$view field=title/></b>: {{my-dtid##$(thisIndex)$}}<br>
\end
\define thisEditListMacro()
<b><$view field=title/></b>: {{my-dtid##$(thisIndex)$}} <$button>Remove<$action-deletefield $tiddler='my-dtid' $field=$(thisIndex)$ $value=''/></$button><br>
\end
\define thisRegEx()
$(thisSearch)$(?i)
\end
\define thisSearchMacro()
<ol>
<$list filter="[[my-dtid]indexes[]regexp:title[(?i)$(thisSearch)$]]">
<li><span style="color:darkred;"><<currentTiddler>></span>: <$transclude tiddler="my-dtid" index=<<currentTiddler>>/></li>
</$list>
</ol>
\end
\define thisEditMacro()
<ol>
<$list filter="[[my-dtid]indexes[]regexp:title[(?i)$(thisSearch)$]]">
<$set name=thisItem value=<<currentTiddler>>>
<li><<thisDeleteButton>> <<currentTiddler>> - <$transclude tiddler="my-dtid" index=<<currentTiddler>>/></li>
</$set>
</$list>
</ol>
\end
\define thisDeleteButton()
<$button set='my-dtid##$(thisItem)$'>{{$:/core/images/delete-button}}</$button>
\end
\define addTerm()
<$action-setfield $tiddler='my-dtid' $index={{$:/temp/my-dtid!!name}} $value={{$:/temp/my-dtid!!meaning}}/>
<$action-setfield $tiddler='$:/temp/my-dtid' name='' meaning=''/>
\end
This is a full example of using DataTiddlers (dictionary or JSON tiddler) for creating a refence book or Word Dictionary. This project was created and authored by Jed carty.
The project includes:
# Macros for add/remove index/value pairs from Data tiddler
# Macros for making search in Data tiddler
# Macros for listing index/value pairs
# A Data tiddler (here a JSON: [[my-dtid]]) to store pairs of index/value.
# Reveal widget is used to prevent adding term with no meaning (empty edit box)
---
!! Demo
Term: <$edit-text class='tc-edit-texteditor' tiddler='$:/temp/my-dtid' field='name'/><br>
Meaning: <$edit-text class='tc-edit-texteditor' tiddler='$:/temp/my-dtid' field='meaning'/><br>
<$reveal type='match' state='$:/temp/my-dtid!!name' text=''>
<$button>Add Term</$button><!-- This is a fake button, when term edit-text is empty -->
</$reveal>
<$reveal type='nomatch' state='$:/temp/my-dtid!!name' text=''>
<$button actions=<<addTerm>> >Add Term </$button>
</$reveal>
<$reveal type='nomatch' state='$:/temp/my-dtid/editreveal' text='edit'>
<$button set='$:/temp/my-dtid/editreveal' setTo='edit'>Edit Dictionary</$button>
</$reveal>
<$reveal type='match' state='$:/temp/my-dtid/editreveal' text='edit'>
<$button set='$:/temp/my-dtid/editreveal' setTo='noedit'>Done Editing</$button>
</$reveal>
!! Search
Search: <$edit-text tiddler='$:/temp/my-dtid' field='search'/><br>
<$reveal type='nomatch' state='$:/temp/my-dtid/editreveal' text='edit'>
Type in the search box to find specific items on the list
</$reveal>
<$reveal type='match' state='$:/temp/my-dtid/editreveal' text='edit'>
Click on the trashcan icon to remove an item
</$reveal>
<$set name='thisSearch' value={{$:/temp/my-dtid!!search}}>
<$reveal type='nomatch' state='$:/temp/my-dtid/editreveal' text='edit'>
<<thisSearchMacro>>
</$reveal>
<$reveal type='match' state='$:/temp/my-dtid/editreveal' text='edit'>
<<thisEditMacro>>
</$reveal>
</$set>
A Dictionary Project.json (3.4 KB)