On Friday, January 8, 2021 at 4:06:27 PM UTC-8 History Buff wrote:
> The copying of the title to the description field with the extra text I
> think is relatively easy. However, I'm having trouble figuring out how to
> extract the first character and the first three characters from the title.
> Any suggestions?
>
Note: the TWCore "toc" macros use the "caption" field (not "description")
to define the text to display for each toc entry.
<$button> set captions
<$list filter="...">
<$action-setfield caption={{{ [[Railroad]] [{!!title}split[]first[]]
[{!!title}split[]first[3]join[]] [{!!title}] +[join[-]] }}} />
</$list>
</$button>
Notes:
* The $list filter is whatever you want to use to select your desired "set
of tiddlers".
* For each matching tiddler, the caption field value is constructed using 5
filter "runs" within a "filtered transclusion" syntax: {{{ ... }}}
* *[[Railroad]]* is literal text
* *[{!!title}split[]first[]]* extracts the first character from the title
* *[{!!title}split[]first[3]join[]]* extracts the first 3 characters from
the title
* *[{!!title}]* is the full title text
* *+[join[-]]* combines the previous 4 parts with "-" in between each part
The result is a single text value, e.g., "Railroad-A-Atc-Atchison, Topeka &
Santa Fe Railway"
which is then stored in the "caption" field of the current tiddler.
enjoy,
-e
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/e117fb6b-159a-4dca-9f9e-a8f012b9f2f7n%40googlegroups.com.