\procedure createTiddler()
<$action-createtiddler $basetitle=<<unusedtitle template:"$count$" startCount:1>> >
<!-- any other processing Todo as part of tiddler creation -->
</$action-createtiddler>
\end
<$button actions=<<createTiddler>> >
Create Tiddler
</$button>
Say we have a tiddler titled “5” and we delete it.
Later, a new tiddler (with the fancier code Mario shared) gets created as “5”.
If we had tiddlers linked to “5” when we deleted “5”, those old “5” links will now point to the new “5” tiddler, which could be weird depending on the content and structure of a TW instance. I think I’d prefer the “5” not get reused later, just so that broken/orphaned links stay broken/orphaned, rather than suddenly be linked to something they shouldn’t be linked to.
That’s right. The unusedtitle-macro duplicates the “New Tiddler x” behaviour, for consistency reasons.
That’s an argument, if you want to keep tiddlers titled 1, 2, 3, 4
I personally do not keep “tiddler x” for long. For me they are temporary. I prefer speaking-tiddler-titles which I can keep for a long time. For journals I do prefer a full timestamp with a 1 second resolution like: journal-2024-12-07-09:56:11
For my redesign of Le P’tit Aurèle, I’m making heavy use of sequence numbers as tiddler titles for the small footprint and because the titles don’t matter other than needing uniqueness. Tags are the human-friendly identifiers. But this really only works because I’m layering my own UI to supplant the native TW interface.
I’ve been following the thread with interest but until now, chose not to engage because my use of sequence numbers didn’t seem to fit with your approach (at least, at first).
Then I thought, why don’t I let you decide?
That’s very much my approach and intention – let me explain:
I use a mostly numeric “pattern” in the title field e.g. “001-010”. The first 3 digits represent a chapter number, the second 3 digits represent a section number. Taken together, the whole thing I call a “chapsec”. In a subtitle field I store the user friendly “title”, something like “The Old Forest”.
In addition, I provide a “New” button that calculates the next chapsec based on the last found section number plus an increment (a configurable value) which is then offered in the UI but can be changed (if, for example, I know there is a gap because I deleted a section).
So when it comes time to start a new chapter…
I avoid that completely by linking to sections via another field called uuid. When a new section is created, the uuid is populated for me. Obviously, I had to write all the code required to make the links work because the native TW linking widgets/macros expect to be supplied a title. It’s then down to me to create links that use the uuid instead of the chapsec value:
<!-- link using uuid -- SAFE! -->
<<svx "a923522b-4218-40ff-b791-7458522e0410">>
<!-- link with chapsec -- VOLATILE! -->
<<svx "002-010">>
About svx:
My chapsecs are displayed in a heavily customized UI called a SectionView. I have three sectionviews which are reflected in the links as sv (sectionview 1) sv2 and sv3 – svx simply means “use the current sectionview”.
Obviously, sv* links display the subtitle field (“The Old Forest”, for example) when rendered.
I’ve been working like this for a decade or more, and while I’m not suggesting you adopt this approach, I am making you aware, it works. IOW, your approach (if you’re willing to put in the work to make links work) is completely valid and usable.
Your type of “sequence” numbers don’t match my type of sequence numbers.
Mine are very much like the kind of sequence numbers you would find in Oracle databases: sequence numbers have zero semantic meaning. They are only a guarantee of unique numbers.
Your unique identifiers are two-part sequential numbers that have semantic meaning/intention.
The first part means chapter. The number for that chapter identifies the order in which that chapter appears in respect to other chapters. The same goes for your sections. The number for each section identifiers the order in which that section appears, within a chapter, in respect to the other sections within the chapter.
It works in other cases as well. I have several wikis that use this mechanism, using a sequence number, where gaps don’t matter but where I would not want links to dead tiddlers to now connect to the new replacements.
For instance, I have a wiki with a tiddler for every voter in my (smallish) town. Personal names won’t do as titles, as there is too much of a chance for conflict. Instead they are listed as, say, Voter/1234, with fields for first-name, last-name, and suffix, as well as a caption such as Voter/Scott Sauyet. There are many gaps in the ids from the system where I gathered these. But there is at least a rough correlation between the id number and when the record was created. I can keep this and use this number to list recently added Voters.
Regarding the chapter value again, I often do this: “01.001-010”. That’s “volume.chapter-section”. All my code really cares about for splitting purposes, is that hyphen.
If it is of any use for this discussion (to provide context, hopefully not muddying things?), I’m in the midst of updating my design documentation for my redesigned Le P’tit Aurèle.