Prannoy Pilligundla wrote:

> Hi Everyone,
> 
> I am almost done with LyX to ODT part of my project and I started work on
> the roundtrip i.e ODT to LyX part of the project. For LyX to ODT I
> converted LyX to LaTeX first and then used tex4ht for converting LaTeX to
> ODT. In case of math I am also storing the latex expression as it as in
> the ODT file(using annotation property) as meta data.

Very nice!

> Now for getting back to LyX from ODT I am thinking of writing a python
> script which does this conversion. As of now I am planning to use the xml
> parsers expat library <https://docs.python.org/2/library/pyexpat.html>.I
> also had a look at lyx2lyx scripts. I tried using Writer2LaTeX but it
> doesn't suit our purpose of getting back the same LyX file. I am not very
> clear on how to go ahead from this juncture. For example I am not clear on
> how I will get information about all the packages used from the ODT file.
> I feel I am not aware of many issues which need to be taken care of during
> this conversion process. It would be great to hear your comments and
> suggestions on how to go ahead

Did you have a look at the old discussions we had before your GSoC project 
started? There were many ideas floating around, but I don't remember the 
details anymore.

I think the most important goal would be to get the structure right. Then it 
becomes complicated: You need to find out if certain modules are needed for 
a certain feature (packages are LaTeX stuff, these should be irrelevant if 
you go from odt to LyX). This can be quite challenging, since you basically 
need to use LyX to get the available modules etc. At this point, you would 
need to reimplement a lot of LyX infrastructure in python.

Another approach would be to interface with the LyX server, query it for 
modules, and let it write the LyX file. Then you would not need to care 
about changing file formats. However, it might be needed to extend the LyX 
server interface, I don't know if it is powerful enough.

Finally, it would also be possible to hack tex2lyx to read odt. You could 
use a lot of the existing infrastructure. Maybe it is not so much work to 
use a C++ XML parser (e.g. from qt) to read the document, then process it 
and use existing code to write the LyX file?


Georg

Reply via email to