Ellipsis /truncate filter result

Hi ,

i am trying to make this effect where a

" very very very long title" is shortened and displayed as

" very very very lo…"

to save space.

which operator should i use ?

thank you

If you can address the problem using CSS…

1 Like

@CodaCoder’s answer is the right one, it will probably be way more flexible. however i took it as a challenge, so here’s my macro:

\procedure truncate(length text)
<$let
filter="[<text>split[]prepend[⨷]move:$1$[⨷]allbefore[⨷]join[]]"
sub={{{[<filter>substitute<length>]}}}>
<$text text={{{[subfilter<sub>addsuffix[...]]}}}/>
</$let>
\end

<<truncate 13 "here is a long text that will be truncated">>

gives

here is a lon...

the primary operator i used was allbefore[], but because you can’t use a variable in the suffix of a filter operator directly i had to break it out and substitute[] it in as text before running it with subfilter[].

i also used a strange unicode character i found as a marker because if the marker is naturally in the tiddler title it will break.

2 Likes

Thanks. But pure wikitext solutions are always welcome :sunglasses:

2 Likes

This may be a useful feature in can add to my alt-title solution however the biggest annoyance is catering for the spaces available given the number of buttons and zoom level.

  • one option may be too hide the buttons on a hamburger giving the title more space.
1 Like

Thanks all,

i used the wikitext solution:)

1 Like