The logic to determine if an ellipsis is shown will always evaluate to false because the variable str is already sliced and has a length equal to @slice
My 2p
data =
case String.length(str) < @slice do
true ->
@quote <> str <> @quote
false ->
str
|> String.slice(0, @slice)
|> (&(@quote <> &1 <> "..." <> @quote)).()
end