[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread PMario
On Thursday, December 13, 2018 at 2:09:15 PM UTC+1, BurningTreeC wrote:
...

I think I don't want such fields, I just want to get those newline 
>> characters correctly into my testtiddler. I believe the problem here is 
>> that I'm using diff-match for visualizing that does some processing I don't 
>> want
>>
>
> That was the problem! :)
>

Glad you found it!

-m

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/2aa60d27-662e-4157-887b-6007969e0ef2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread BurningTreeC


>
> On Thursday, December 13, 2018 at 1:41:48 PM UTC+1, BurningTreeC wrote:
>> ...
>>
>>> I want to see how far I can go with wikitext only :P
>>>
>>
>> I see. ... forgive my ignorance: IMO That's completely inefficient. ... 
>> Some string manipulations, like find and replace are 1 liners in 
>> javascript. 
>>
>
> I forgive. This is very inefficient. But we shouldn't ignore the point how 
> far wikitext can go, could help understanding what not to do and what to 
> fix where.
>
>
>> So if you want to have "multi-line" or "tag-like" fields you'd need to 
>> dig much deeper into the core and fix it there. 
>>
>> -m
>>
>
> I think I don't want such fields, I just want to get those newline 
> characters correctly into my testtiddler. I believe the problem here is 
> that I'm using diff-match for visualizing that does some processing I don't 
> want
>

That was the problem! :)

Now I've removed diff-match, I used it just to see where those characters 
are, made other problems by inserting invisible space or whatever somewhere

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/aaf08d7a-7c4e-4b9d-b013-a3a3bcfc3711%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread BurningTreeC


> On Thursday, December 13, 2018 at 1:41:48 PM UTC+1, BurningTreeC wrote:
> ...
>
>> I want to see how far I can go with wikitext only :P
>>
>
> I see. ... forgive my ignorance: IMO That's completely inefficient. ... 
> Some string manipulations, like find and replace are 1 liners in 
> javascript. 
>

I forgive. This is very inefficient. But we shouldn't ignore the point how 
far wikitext can go, could help understanding what not to do and what to 
fix where.


> So if you want to have "multi-line" or "tag-like" fields you'd need to dig 
> much deeper into the core and fix it there. 
>
> -m
>

I think I don't want such fields, I just want to get those newline 
characters correctly into my testtiddler. I believe the problem here is 
that I'm using diff-match for visualizing that does some processing I don't 
want

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ab89cf61-f010-43f9-a765-68883009af7d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread PMario
On Thursday, December 13, 2018 at 1:41:48 PM UTC+1, BurningTreeC wrote:
...

> I want to see how far I can go with wikitext only :P
>

I see. ... forgive my ignorance: IMO That's completely inefficient. ... 
Some string manipulations, like find and replace are 1 liners in 
javascript. 

So if you want to have "multi-line" or "tag-like" fields you'd need to dig 
much deeper into the core and fix it there. 

-m

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/6bea3d81-dfd6-4fc1-bd60-084663e1ea10%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread BurningTreeC
To explain what the (complicated, yes that's true) macros do:

they split the input string into single characters prefixed with an index 
from 1 to text-length, so I have an array:

1h 2e 3l 4l 5o 6%20 7{ 8{ 9$ 10: 11/   and so on

they are numbered so that each list-item is unique

depending what I want to do, I can enlist these numbered characters, remove 
the prefixed number, knowing at what index I am, and doing stuff with the 
character, like matching it and the following ones against a prefix or just 
replacing it or whatever

I can also count the lines if I want, telling at which line something is, I 
guess I can also figure out the index of the char at that specific line

I want to see how far I can go with wikitext only :P


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/ec5218ff-8d3e-43e8-ad44-d4801cf06641%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread PMario
On Thursday, December 13, 2018 at 1:19:52 PM UTC+1, BurningTreeC wrote:
>
>
> I haven't looked into the capabilities of the diff-match-patch widget, 
> though - can it do this out of the box?
>

I was thinking about the low-level box: 
https://github.com/google/diff-match-patch/wiki/API

-m

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/87dc1b18-900c-44d5-865f-17ce9eefc588%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread BurningTreeC


> Hi BTC,
>
> I'm not really sure, what you try to achieve here. ... I do have a guess. 
> ... And I think "you'r doing it wrong". 
>
> I'm using the diff-match-patch widget to get the text with its new-lines 
>> and tabs as characters
>>
>
> IMO diff-match-patch mechanism can do everything you did with complicated 
> macros (almost) out of the box. 
>
> Can you describe, what you want to achieve. 
>
> -mario
>

Hi Mario, I'm playing around with splitting strings into single characters, 
then putting them back together. That's what I'm doing in the first place. 
I wouldn't need the diff-match-patch here, I just use it to get those 
special characters visualized

Here I'm trying to replace single characters without changing the overall 
formatting and without looking into javascript

I haven't looked into the capabilities of the diff-match-patch widget, 
though - can it do this out of the box?

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/19d198a3-85bf-4c86-a189-66bc069a51c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread PMario
Hi BTC,

I'm not really sure, what you try to achieve here. ... I do have a guess. 
... And I think "you'r doing it wrong". 

I'm using the diff-match-patch widget to get the text with its new-lines 
> and tabs as characters
>

IMO diff-match-patch mechanism can do everything you did with complicated 
macros (almost) out of the box. 

Can you describe, what you want to achieve. 

-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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/077db207-7056-4bc8-a1dd-7fd9a930548b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread BurningTreeC


> Hi 
>
> TW uses "\n" and removes "\r" for every OS. It even makes a big difference 
> in file size.
>
> -m
>

Thanks Mario, I've changed that back. I had experimented with all kinds of 
combinations, starting with "\n" only

But even so it inserts newline characters, but the resulting tiddler looks 
(when open for editing) exactly like the original, but the rendered tiddler 
does not, it doesn't insert the  when there are consecutive new-lines

Hitting backspace at the start of such a generated newline makes that 
newline be recognized as such, it seems as if I'm deleting an invisible 
character


I'll post the macro if you're interested in having a look

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/de8f1258-4b34-4ca9-ac7a-22fecf3124af%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-13 Thread PMario
Hi 

TW uses "\n" and removes "\r" for every OS. It even makes a big difference 
in file size.

-m

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/2ebcb1c4-70e0-42b5-9269-1d834a4c0c02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[tw5] Re: How to correctly insert new-line characters through a setfield widget

2018-12-12 Thread BurningTreeC
To test this, try the following on tiddlywiki.com for example:

put this in some tiddler:

<$button><$action-setfield $tiddler="test" text={{{ 
[[jsontiddler]getindex[test]] }}}/>Ok

create the tiddler "jsontiddler" with its type set to "application/json" 
and put the following inside: 

{
"test": "\r\n\r\nhello\r\n\r\nlala\r\n"
}

save and hit the Ok button. the tiddler "test" gets created with the text 
from the "test" index, but the new-line characters are actual new-lines

oddly enough, this works correctly. So I'm wondering now what I'm doing 
wrong in my macro


-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/1f436327-3c74-4848-b2b9-295fefdf8351%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.