[tw5] Re: Tool to create direct tiddler links which do not break after the change of the tiddler title

2019-02-16 Thread 'Vytas' via TiddlyWiki
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$>>

\end


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


\define if_no_id() 
<$action-setfield $tiddler=<> id=<>/>
<$action-setfield $tiddler=<> aliases=<>/
>
<$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=<>>
<$wikify name=cr_date text='<$view  tiddler=<> 
field="created" format="date" template="-0MM-0DD"/>'>
<$wikify name=cr_time text='<$view  tiddler=<> field=
"created" format="date" template="0hh:0mm:0ss"/>'>
<$wikify name=cr_msec text='<$view  tiddler=<> field=
"created" format="date" template="XXX"/>'>
<$set name="curr_title" tiddler=<> field="title">
<$set name="old_aliases_value" tiddler=<> field="aliases">
<>





{{$:/core/images/link}} 


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


[tw5] Re: Tool to create direct tiddler links which do not break after the change of the tiddler title

2019-02-10 Thread Mohammad
Hello Vytas,
 One solution is the linkto macro creates the link in any case. So, 
Tiddlywiki will take care of links to missing tiddlers (show them as italic 
blue).
I mean the macro should have an output.

--Mohammad


On Sunday, February 10, 2019 at 1:23:41 PM UTC+3:30, Vytas wrote:
>
> Mohammad,
>
> Thanks for making the point. I can just write:
>  
> <$list filter="[field:id[$idvar1$]!has[draft.of]limit[1]]" 
> emptyMessage="''//missing tiddler//''"/>
>
> instead of 
> <$list filter="[field:id[$idvar1$]!has[draft.of]limit[1]]"/>
>
> Then, <> will render as *missing tiddler *when 
> the corresponding tiddler does not exist. 
> However, I don't know how to "handle it as missing tiddler". Do you have 
> any ideas?
>
>
> I am aware of Mario's plugin. One of my motivations was not to be forced 
> to remember titles, aliases or ids. So, you can use a descriptive title 
> (which you can change without being punished) *to find* the tiddler you 
> want to link to and then just copy a link to that tiddler with a click of a 
> button. Big advantage is that you do not have to enter aliases or ids by 
> hand: *one* click of button creates a very *readable and informative* id 
> (in terms of wikitext readability) *and* copies a link. Moreover, you do 
> not have to create ids for every single tiddler. You just need ids for 
> those tiddlers you want to create *direct* links to. So, you naturally 
> create an id once you want to link to it. At that moment, tiddler title is 
> already set and plays its descriptive role, which you can make use of by 
> *one* click of a 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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/e8e12461-da1c-48d1-a6ff-c344977b38da%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Tool to create direct tiddler links which do not break after the change of the tiddler title

2019-02-10 Thread 'Vytas' via TiddlyWiki
Mohammad,

Thanks for making the point. I can just write:
 
<$list filter="[field:id[$idvar1$]!has[draft.of]limit[1]]" 
emptyMessage="''//missing tiddler//''"/>

instead of 
<$list filter="[field:id[$idvar1$]!has[draft.of]limit[1]]"/>

Then, <> will render as *missing tiddler *when 
the corresponding tiddler does not exist. 
However, I don't know how to "handle it as missing tiddler". Do you have 
any ideas?


I am aware of Mario's plugin. One of my motivations was not to be forced to 
remember titles, aliases or ids. So, you can use a descriptive title (which 
you can change without being punished) *to find* the tiddler you want to 
link to and then just copy a link to that tiddler with a click of a button. 
Big advantage is that you do not have to enter aliases or ids by hand: *one* 
click of button creates a very *readable and informative* id (in terms of 
wikitext readability) *and* copies a link. Moreover, you do not have to 
create ids for every single tiddler. You just need ids for those tiddlers 
you want to create *direct* links to. So, you naturally create an id once 
you want to link to it. At that moment, tiddler title is already set and 
plays its descriptive role, which you can make use of by *one* click of a 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/0eb8bb29-a0a6-482c-982a-375f6a0264ee%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: Tool to create direct tiddler links which do not break after the change of the tiddler title

2019-02-08 Thread Mohammad
Hello,
 This is simple but very handy tool. 
A minor comment: When you delete a tiddler already refereed by <> somewhere, there is nothing to show and I recommend to display a 
massage or much better handle it as missing tiddler, on click you can 
create it.


Have a look also to https://wikilabs.github.io/editions/uni-link/ by Mario.

On Saturday, February 9, 2019 at 2:21:53 AM UTC+3:30, Vytas wrote:
>
> Hello,
>
> After a long pause from TiddlyWiki, I came back to simplify my tool (
> https://groups.google.com/d/msg/tiddlywiki/DiowJLeoJbw/igirhRHYAQAJ) of 
> creating solid links to tiddlers with the help of a "link button" in the 
> View Toolbar. The tool functions through the id field and it is really easy 
> to use.
>
> a) If you want to create a link to the tiddler named *Present tiddler 
> title* (created *20190208203055849*) AND having no "id" field value, just 
> click the "link button" in the View Toolbar of this tiddler. This will set 
> the "id field" to "*2019-02-08-Present tiddler title-22:30:55-849ms*" AND 
> will copy *<>* to 
> clipboard. Now, you can paste this macro into some other tiddler to get a a 
> direct link to *Present tiddler title*. If the id value would appear to 
> be not unique (e.g., if you clone a tiddler), the macro will provide the 
> link to the oldest tiddler which has the above mentioned id.   
>
> b) If "Present tiddler title" already HAS an id field value (assume it is 
> equal to *any_preferably_unique_id_591*), clicking the "link button" in 
> the View Toolbar will copy *<> *to 
> clipboard.
>
>
> To try out the tool, create a tiddler (tagged with *$:/tags/Macro* and 
> *$:/tags/ViewToolbar*) with the following body text:
>
>
> \define linkto(idvar1) 
> <$list filter="[field:id[$idvar1$]!has[draft.of]limit[1]]"/>
> \end
>
> \define linkto2(idvar)
> <>
> \end
>
> \define id_value() $(cr_date)$-$(curr_title)$-$(cr_time)$-$(cr_msec)$ms
>
> \define link_via_id(check_id, copy_id, if_no_id)
> <$list filter="$check_id$ +[limit[1]]" name=act emptyMessage=<<$if_no_id$
> >>>
> <<$copy_id$>>
> 
> \end
>
> \define copy_id() 
> <$action-sendmessage $message="tm-copy-to-clipboard" $param=< "$(idvar)$">>/>
> \end
>
> \define if_no_id() 
> <$action-setfield $tiddler=<> id=<>/>
> <$action-sendmessage $message="tm-copy-to-clipboard" $param=< "$(id_value)$">>/>
> \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=< class>>>
> <$wikify name=cr_date text='<$view  tiddler=<> 
> field="created" format="date" template="-0MM-0DD"/>'>
> <$wikify name=cr_time text='<$view  tiddler=<> 
> field="created" format="date" template="0hh:0mm:0ss"/>'>
> <$wikify name=cr_msec text='<$view  tiddler=<> 
> field="created" format="date" template="XXX"/>'>
> <$set name="curr_title" tiddler=<> field="title">
> <$set name="idvar" tiddler=<> field="id"> 
> <>
> 
> 
> 
> 
> 
> {{$:/core/images/link}} 
> 
>
> You can provide this tiddler with the following fields:
> caption: *{{$:/core/images/link}} (Set id) & copy a link*
> description: *Set the id field (if it does not exist) of this tiddler and 
> copy a link to clipboard*
>
> By the way, I don't know how to make the caption show up, as long as the 
> "link button" is put under *More actions* in the View Toolbar..  
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@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/0034d438-b6a7-4891-b63c-65349650be23%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.