These are chat archives for synrc/n2o

15th
Feb 2017
Andy
@m-2k
Feb 15 2017 11:37
KVS next iterator support synrc/kvs#31
Sébastien Saint-Sevin
@seb3s
Feb 15 2017 14:47
Hi Andy
did you get a chance to run the modified js_escape ?
what figures do you get ?
Andy
@m-2k
Feb 15 2017 16:38
Later
Namdak Tonpa
@5HT
Feb 15 2017 18:19
maybe I can merge?
is there PR ?
Andy
@m-2k
Feb 15 2017 19:35
нету
Andy
@m-2k
Feb 15 2017 19:55
@5HT n2o and nitrogen convert functions very different. upgrade to the nitrogen version?
Andy
@m-2k
Feb 15 2017 20:51
OMG, it is necessary to rewrite completely, bullshit here
iolist_to_binary, BigNum > 255 ahaha, oh U
Andy
@m-2k
Feb 15 2017 23:43
okay, i rewrite wf:html_encode: 17 LOC total ahahaha
Sébastien Saint-Sevin
@seb3s
Feb 15 2017 23:45
Hi Andy
Andy
@m-2k
Feb 15 2017 23:45
yep
Sébastien Saint-Sevin
@seb3s
Feb 15 2017 23:45
Here is my simplified version
I don't like whites encoding
html_encode(Value) when is_atom(Value)      -> html_encode(wf:to_binary(Value));
html_encode(Value) when is_integer(Value)   -> html_encode(wf:to_binary(Value));
html_encode(Value) when is_float(Value)     -> html_encode(wf:to_binary(Value));
html_encode(Value) when is_binary(Value)    -> html_encode(Value, []).

html_encode(<<">",      Rest/binary>>, Acc) -> html_encode(Rest, [Acc | "&gt;"]);
html_encode(<<"<",      Rest/binary>>, Acc) -> html_encode(Rest, [Acc | "&lt;"]);
html_encode(<<"\"",     Rest/binary>>, Acc) -> html_encode(Rest, [Acc | "&quot;"]);
html_encode(<<"'",      Rest/binary>>, Acc) -> html_encode(Rest, [Acc | "&#39;"]);
html_encode(<<"&",      Rest/binary>>, Acc) -> html_encode(Rest, [Acc | "&amp;"]);
html_encode(<<"\n",     Rest/binary>>, Acc) -> html_encode(Rest, [Acc | "<br>"]);
html_encode(<<C:8,      Rest/binary>>, Acc) -> html_encode(Rest, [Acc | [C]]);
html_encode(<<>>, Acc) -> list_to_binary(Acc).
Reuse what you want, no pb
Andy
@m-2k
Feb 15 2017 23:46
no, html_encode(Rest, [Acc | "any"]); it's bullshit for list_to_binary usage
very deeper list
Sébastien Saint-Sevin
@seb3s
Feb 15 2017 23:47
yep can remove that
It was coming from whites as well I think
Andy
@m-2k
Feb 15 2017 23:48
wf:jse made later. also decode
Sébastien Saint-Sevin
@seb3s
Feb 15 2017 23:51
can you show me the 17 LOC ?