On Thursday, April 29, 2021 at 12:26:23 PM UTC+2 Mohammad wrote:

> It is known that the newline character is different for different OS (see 
> Wikipedia <https://en.wikipedia.org/wiki/Newline>). I am not sure if this 
> is also true for the browsers or not!
>

1) If you save a multiline tiddler in TW to the internal store `\n` will be 
used.
2) If you copy paste content from a file to TW it will use \n

3) If you import eg: test.txt from windows there will be "\r\n" in the 
tiddler. 
The next time you edit the tiddler and save there will be  "\n" only. 

 

> Having that said, what is the best practice to treat a newline character 
> in a Tiddlywiki filter to work everywhere!
>
> *Case i*
>
> <$list filter="[<source>splitregexp[\n]]" ...
>

So for case 3 it will look like, if it works, but it will keep the \r in 
memory. 
If you want to remove it use: 

<$list filter="[<source>splitregexp[\r?\n]]" ... this will always work for 
all OSes. 

\r? .. means check for \r  optional ... only if it exists 

 

> *Case ii*
> <$vars newline="
> " >
> <$list filter="[<source>splitregexp<newline>]" ...
>

hmm. This won't help since internally we only use \n

hope that helps
mario

>

-- 
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/5ddca5cc-61f1-49fa-a49e-54997632a593n%40googlegroups.com.

Reply via email to