On Saturday, August 15, 2020 at 9:40:47 AM UTC-7, Adithya B M wrote:
>
> Can you suggest any better way to extract the a "excerpt" of a tiddler?
> I found this get_extract function searching this forum but it kind of 
> breaks the text by eating the formatting html. I just want plaintext of the 
> first 140 characters or so with non-relevant characters replaced by spaces 
> (and multiple spaces trimmed to one).
>

Perhaps if you wikify the *entire* tiddler text first, and then take the 
first 140 characters from that, you will avoid "eating the formatting".
\define get_description()
<$wikify name="out" text={{{ [<currentTiddler>get[text]] }}}>
<$vars  extract={{{ [<out>split[]first[140]join[]] }}}>
<$text text={{{ [<currentTiddler>get[description]else<extract>] }}} />
</$vars>
</$wikify>
\end

-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/45960e75-ecb4-42fc-8c1e-d693a0320248o%40googlegroups.com.

Reply via email to