Is there a way of making an internal link, such as [[Contents]] return the caption field of the Contents tiddler (if it was available) rather than title?
Is there a way of making an internal link, such as [[Contents]] return the caption field of the Contents tiddler (if it was available) rather than title?
To give you some background, I am writing a collaborative document and section titles are starting to become length and subject to being changed or reworded. I am therefore starting to work on a system where I am using tiddler titles as a short succinct title and the caption field as the long title.
The files include a macro that when invoked like <<MyTiddler>> returns a link to "My Tiddler Caption". This macro is used by the other bit of code, which overwrites the core prettylinks code to use the macro whenever you have a "pretty link" (e.g. a link with [[...]]). BUT, if your link includes a title inside it, then the manual title will 'win' over the caption. (e.g. [[My Inline Text|MyTiddler]] will show 'My Inline Text').
But if it only needs to be short for menus ... just use it for menus and let it be long for other things. A photo 'caption' is often long. If the intention was that the content be short, there should have been a 'short-title' field.
The 'title' field is really, and unfortunately, an id field. There needs to be a standard field for long, mutable descriptions.
subtitle might work. I see that its been used exactly 6 times so far. But what I liked about 'caption' was that it automatically got used in the toc macros. Perhaps the toc macros could be written to select the titles with this priority:
caption -> subtitle -> title
\define returnText(tid) <$transclude tiddler="""$tid$""" field=subtitle><$transclude tiddler="""$tid$""" field=title/></$transclude>
\define phony(tid) <$link to="""$tid$"""><<returnText """$tid$""">></$link>
Oh snap -- I knew there must be some other way to make collapsing titles besides the view widget. But the text widget doesn't work and I forgot about the transclude widget.
I don't think "phony " is quite the right term. It's a bit pejorative. Maybe "prettierlinks"?
Mark
I don't think "phony " is quite the right term. It's a bit pejorative.
Maybe "prettierlinks"?
The problem with Tobias' macro in this context, in addition to probable performance issues (it uses both list and regex), is that it can be broken if a person, for instance, clones a tiddler and forgets to update the alias field. At that point a linker using his macro will pick one of 2 possible sites (whichever the regex finds first) and link to it.
I'm not sure what is being compared here.
When you say 'prettylink', do you mean the native prettylink ability, the ability to force a title inline or ??
... (though I don't know why someone would turn it off)
and rolled as a plugin would be good.
.... When creating the links its a lot easier to point them to the shorter tiddler title, but it would be nice to allow the previewed text (which is read by the uninitiated) to see the current long form.