Question about extracting part of a title

Hi, fairly new here, so if this has been discussed before then excuses.

I have a group of tiddlers each with the data for one race. They have the tag Race.

To keep them organized, I prefix them with R- R-Aelfar for example for the Aelfar Race.

To list some early data I have this list/table:


<table>
<$list filter= "[tag[Race]]">
 <tr>
<td><$link>{{[[!!title}}]split[R-]]</$link></td><td>{{!!Arrival Time}}</td><td>{{!!Ip Cost}}</td><td>{{!!Numbers Present}}</td><td>{{!!Rarity}}</td><td>{{!!Use Potential}}</td>
</tr>
</$list>
</table>

But I am struggling how to remove the R- part from the title.

They are now listed as R-Aelfar for example.

I could use another field with the name, but the split operator should give me the name without the R-.

I have tried it here with the title field.

The following also did not work:


<table>
<$list filter= "[tag[Race]]">
 <tr>
<td><$link>[<currentTiddler!!title>split[R-]rest[]]</$link></td><td>{{!!Arrival Time}}</td><td>{{!!Ip Cost}}</td><td>{{!!Numbers Present}}</td><td>{{!!Rarity}}</td><td>{{!!Use Potential}}</td>
</tr>
</$list>
</table>

So my question is how to extract the name of the race and put the truncated name in the table?

Edit: made code blocks as otherwise the table would be shown.

Your syntax is a little bit wonky (misplaced square brackets and curly braces)…

Try this:

<$link><$text text={{{ [{!!title}removeprefix[R-]] }}}/></$link>

Notes:

  • The tripled curly braces surround a “filtered transclusion”.
  • Within the filtered transclusion, the outermost square brackets mark the start/end of a “filter run”
  • The {!!title} syntax retrieves the full title text of the current tiddler. Note how, within filters, use only single curly braces, while in regular wikitext, use doubled curly braces (i.e., {{!!title}})
  • The $text widget ensures that, after removing the “R-” prefix, if the resulting text uses “CamelCase”, it will not be automatically rendered as a separate link. The surrounding $link widget creates the actual clickable link.

-e

4 Likes

It worked!

And sorry for the wonky syntax, working with TW for nine days now =)

Edit: thank you for the extra notes.

I have disabled CamelCase after initially activating it, as it could give undesirable Tiddlers.

The extra notes help to explain why this works.