Hi,

Motivated by the discussion 
(https://groups.google.com/forum/#!topic/tiddlywiki/Y1V7oyBLpSs) about the 
breakage of tiddler links, I have followed the ideas by Mark S., TonyM, 
Jeremy and others to create four tiddlers, which you will find attached to 
this post:


   1. "initiate-id-change" provides a button in ViewToolbar of a tiddler 
   (consider a tiddler with title "First tiddler title" and creation time 
   "20180430183239679"). This button will start a dialog to set the the value 
   of the "id" field for a tiddler under consideration.
   2. "finalize-id-change" provides a modal dialog with a Confirm button 
   which will set the "id" field of "First tiddler title" to "2018-04-30-First 
   tiddler title-21:32:39-679ms". Now, let's say you have changed the title 
   "First tiddler title" to "Actual tiddler title".
   3. "excise-title" provides a button in EditorToolbar (of "Some other 
   tiddler") which will excise the selected tiddler title (e.g. "Actual 
   tiddler title") into a temporary tiddler.
   4. "insert-linktoid" provides another button in EditorToolbar (of "Some 
   other tiddler") which, by making use of the tiddler title stored in a 
   temporary tiddler, will insert a macro <<linktoid "2018-04-30-First tiddler 
   title-21:32:39-679ms">> in the edit-window of "Some other tiddler". In the 
   view-window, the outcome of this macro will be the same as of [[Actual 
   tiddler title]].

Advantages of this method:

   - You can change the title of the tiddler without breaking links to it, 
   as long as you link via id which remain fixed.
   - While IDs are highly readable, their writability is provided by 
   excision and buttons.

Known disadvantages:

   - The assigning of IDs is not completely automatic. For every tiddler 
   you want to link to, you have to press two buttons to generate its ID (you 
   can limit it to one button if you do not want the confirmation step).
   - I have not managed to reduce the production of a link from the 
   selected title to one click of a button. So far, you have to click one 
   button to excise the title and another button to produce the link.
   - The "linktoid" macro provides soft links, so they "are not detected by 
   link-related filter operators such as backlinks, links, all and is".


In this post, for easier access, I will provide the body text of two of the 
four tiddlers. (I remind that these tiddlers require appropriate tags and 
fields, which are part of the attached .json files.) 

I would enjoy getting any feedback or ideas how to optimize/improve this 
tool. Anyway, I hope that it works not only for me :) 

Vytas 
  
----------------------------------------------

The body text of "finalize-id-change":

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


<$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">


You are about to change the 'id' field value of <$link to=<<currentTiddler
>>><<currentTiddler>></$link> to:
<p>''<<id_value>>''.</p> 
This can break existing links to <$link to=<<currentTiddler>>><<
currentTiddler>></$link>.


<p>
<$button tooltip="Set id to this tiddler">
<$action-setfield $tiddler=<<currentTiddler>> id=<<id_value>>/>
<$action-sendmessage $message="tm-close-tiddler" 
$param="finalize-id-change"/>
Confirm 
</$button>
</p>


</$set>


</$wikify>
</$wikify>
</$wikify>


The body text of "insert-linktoid":

\define linktoid(idvar) 
<$list filter="[field:id[$idvar$]!has[draft.of]]"/>
\end


\define linktoid2(idvar) 
<<linktoid "$idvar$">>
\end


<$set name="titlevar" tiddler="$:/temporary_tiddler_for_title_storage" field
="text">
<$set name="idvar" tiddler=<<titlevar>> field="id"> 
<$action-sendmessage
 $message="tm-edit-text-operation"
 $param="replace-selection"
 text=<<linktoid2 $(idvar)$>>
/>
<$action-deletetiddler $tiddler="$:/temporary_tiddler_for_title_storage"/>
</$set>
</$set>

-- 
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/8712e6b4-a7b2-437d-9c55-d96233eb503e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: excise-title.json
Description: application/json

Attachment: initiate-id-change.json
Description: application/json

Attachment: finalize-id-change.json
Description: application/json

Attachment: insert-linktoid.json
Description: application/json

Reply via email to