Thomas,
I checked the code, if you delete tid-2, it will try to create tid-3, but
as there is a tid-3, it creates tid-3 1
SO there is no risk of overwriting.
I can add extra code to check the existence and and if it exist it
increment the number to find the next empty number!
This way you can even find which tiddlers have been deleted.
See below
\define newTitle() myTiddler-{{{[tag[myTag]count[]add[$(inc)$]]}}}
\define newTiddler(n:0)
<$set name="inc" value={{{ [<__n__>add[1]] }}}>
<$wikify name="myTitle" text="<<newTitle>>" >
<$list filter="[<myTitle>] +[!has[title]]"
emptyMessage=""" <$macrocall $name="newTiddler" n=<<inc>> /> """>
<$action-createtiddler $basetitle=<<myTitle>> tags="myTag" />
</$list>
</$wikify>
</$set>
\end
- The list widget now checks if a tiddler with the new title is exist or
not
- If the tiddler is existed, then it increments by one and continues for
the next sequence number
- It will then create a tiddler with unique name
-- Mohammad
On Friday, February 22, 2019 at 1:46:35 PM UTC+3:30, Thomas Elmiger wrote:
>
> Hi Mohammad
>
> I see a risk here in the count part:
>
> Say you have made tid-1, tid-2 and tid-3. Then you delete tid-2. The next
> generated number will be 3 and collide with existing tid-3.
>
> Just a thought.
>
> Cheers,
> Thomas
>
>
--
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/32aca064-41f5-4246-8cf2-64810fc0dd12%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.