Offray, On 17 Sep 2014, at 18:50, Offray Vladimir Luna Cárdenas <off...@riseup.net> wrote:
> Hi, > > Finally, with help in the Moose mailing list (thanks Doru!), I have automatic > update of nodes in my outliner, and its working pretty well. It is good that you are making progress. > I'm using STON for persistence and I see that when I update a node body > content I got a lot of metadata on the text like runs, text font, text color, > lastIndex, lastOfset. For reference I have attached two files, test.1.ston > which is the original outline with no updates on nodes and test.2.ston which > contains the updated nodes with metadata. 0. The goal of STON is to produce a faithful, textual, somewhat readable, representation of an object graph (with object sharing and circular references) that can be read to recreate the same object. JSON was the starting point, the inspiration, but JSON is too limited to implement the stated goal. > So my questions are: > > 1. There is any way to exclude the text metadata or to select the "deepness" > of the exportation, including just the content of the text, but not the > metadata of it? You can override/reimplement #toSton: and #fromSton: (check the other implementors) to customize how your objects are handled. Looking at your example, I don't really see the problem, you used Text instances, so they are serialized as such. This way, potential styling is preserved. > 2. I see that there is a way to export from STON to JSON. There are plans to > implement something like YAML[1] export? If not, which would be a good > approach to explore the existing code on STON-Core and implement this? No, that is not a goal/objective at all, there is no framework for that. The JSON thing is a hack 'because it could be done', it cannot support the stated goal. > 3. I have seen that text string containing a carriage return are stored with > "\r" character in them, there is any way to make the text be stored > containing actual carriage returns? STONWriter will escape all dangerous characters by default and this is not optional (right now). You are however free to use those characters in strings, it should work as expected with STONReader. From your earlier questions I infer that you want to turn STON in some kind of literal programming language. This is quite far from the original goal. You are of course free to use STON as inspiration or building block. Sven > [1] https://en.wikipedia.org/wiki/YAML > > Thanks, > > Offray > <test.1.ston><test.2.ston>