Mohammad,

as you pointed to Mario's uni-link plugin, I made a version my tool, where 
in case of a missing "id field" value, the "link button" creates an id 
(*2019-02-08-Present 
tiddler title-22:30:55-849ms*) AND a new alias equal to that id AND copies 
a corresponding link of the uni-link form ("[[*2019-02-08-Present tiddler 
title-22:30:55-849ms|?t*]]") to clipboard. 

In case there is a non-empty "id field" value, the "link button" will copy 
"[[*2019-02-08-Present tiddler title-22:30:55-849ms|?t*]]") to clipboard 
(it is assumed that one of the aliases is equal to the "id field" value).

So, the following tiddler (tagged with *$:/tags/Macro* and 
*$:/tags/ViewToolbar*) could be useful to the uni-link users:

\define id_value() $(cr_date)$-$(curr_title)$-$(cr_time)$-$(cr_msec)$ms


\define new_aliases_value()
$(old_aliases_value)$ [[$(id_value)$]]
\end


\define text_for_clipboard()
[[$(id_value)$|?t]]
\end


\define link_via_id(check_id, copy_link, if_no_id)
<$list filter="$check_id$ +[limit[1]]" name=act emptyMessage=<<$if_no_id$>>>
<<$copy_link$>>
</$list>
\end


\define copy_link() 
<$action-sendmessage $message="tm-copy-to-clipboard" 
$param=<<text_for_clipboard>>/>
\end


\define if_no_id() 
<$action-setfield $tiddler=<<currentTiddler>> id=<<id_value>>/>
<$action-setfield $tiddler=<<currentTiddler>> aliases=<<new_aliases_value>>/
>
<$action-sendmessage $message="tm-copy-to-clipboard" $param=<<
text_for_clipboard>>/>
\end


<$button tooltip="Set id (if no id field exists) & copy a link" 
aria-label="Set id (if no id field exists) & copy a link" 
class=<<tv-config-toolbar-class>>>
<$wikify name=cr_date text='<$view  tiddler=<<currentTiddler>> 
field="created" format="date" template="YYYY-0MM-0DD"/>'>
<$wikify name=cr_time text='<$view  tiddler=<<currentTiddler>> field=
"created" format="date" template="0hh:0mm:0ss"/>'>
<$wikify name=cr_msec text='<$view  tiddler=<<currentTiddler>> field=
"created" format="date" template="XXX"/>'>
<$set name="curr_title" tiddler=<<currentTiddler>> field="title">
<$set name="old_aliases_value" tiddler=<<currentTiddler>> field="aliases">
<<link_via_id "[title[$(currentTiddler)$]has[id]]" copy_link if_no_id>>
</$set>
</$set>
</$wikify>
</$wikify>
</$wikify>
{{$:/core/images/link}} 
</$button>

-- 
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 post to this group, send email to [email protected].
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/ca755662-2ee7-4c2a-85de-f35e53bca406%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to