On Thu, May 2, 2013 at 2:22 PM, Richard Heck <rgh...@lyx.org> wrote: > On 05/02/2013 03:16 PM, Nico Williams wrote: >> >> On Thu, May 2, 2013 at 2:01 PM, Tommaso Cucinotta <tomm...@lyx.org> wrote: >>> >>> As an immediate concern, adding to Pavel's ones, I have to say that I'm >>> not >>> so sure that merging different edits on the .lyx file level, very much >>> like a >>> version control system would do in presence of concurrent commits, would >>> actually be guaranteed to produce a consistent/legal .lyx file. >> >> You need a representation that makes merging feasible. A typical >> 3-way diff/merge like, say, git uses, cannot produce legal C, XML, ... >> by itself. It is possible to build 3-way diff/merge that can produce >> valid merged output for specific syntaxes. In particular it should be >> possible for XML and other nested/parse-tree-like formats. I believe >> there are some non-free, proprietary XML 3-way diff/merge tools that >> don't suck, but they are non-free and I've not tried them. >> >> If this is the tack you want to follow for collaborative distributed >> LyX editing then I think it'd be best to write a 3-way diff/merge for >> .lyx or some representation of it. A 3-way diff/merge for XML would >> also be useful in this respect, though it'd bring in more bloat, but >> it'd also be incredibly useful in general. > > > And if we went to an XML format.....
:) I took a look at the *import* side and I think it wouldn't be hard to read XML in LyX. I haven't looked a the save side, but I suspect it's not terribly hard there either. The biggest problem w.r.t. saving are the places where LyX does not stick to strict containership (and which I deal with in my lyx2xml script by auto-closing (and sometimes re-opening) tags as implied by the .lyx. For example, \series and friends. This can be dealt with in XML saving code like I do in lyx2xml, or by changing the handling of such tokens to always follow strict containership. OTOH, changing the internals so that LyX always deals with XML objects, as if .lyx were a DOM, is probably order sof magnitude more work than making LyX open/save XML. In fact, a GSoC project to load/save XML would probably be quite useful. Nico --