How can I build a filter that uses split and join... and does not eat the \n newline characters?

With the help of some sympathetic tiddleurs I tried to build a (REGEX?-) filter that only displays a part of the tiddler

This works

<$let splitteR="<<pic" numbeR="2" currentTiddler="Charles Baudelaire">
<$list filter="[<currentTiddler>get[text]] +[splitregexp<splitteR>first<numbeR>join<splitteR>]" >
<div style="display:block">{{!!title}}</div>
</$list>
</$let>

but seems to eat the \n characters and thus destroys the formating.
Is there a way to avoid this.
PS: I uploaded this testset.json (2.3 KB) to try it out.

Try this:

\define choppeR()
<$list filter="[<currentTiddler>get[text]] +[splitregexp<splitteR>first<numbeR>join<splitteR>]" >

{{!!title}}
</$list>
\end

The blank line before {{!!title}} is what allows the TWCore parser output to be rendered in “block mode”, so that the the “blockquote” (<<<) syntax in the text gets displayed correctly.

enjoy,
-e

2 Likes

Thank you @EricShulman, this truly was Occam’s razor preventing me from spending another two hours trying out complicated stuff.

1 Like