Andrea Censi wrote:

> Hello to all, and happy new year!
> 
> For my own fun (something related to this:
> http://maruku.rubyforge.org/) I want to parse LyX files. I am only
> interested in basic stuff (paragraphs, lists, inline and block math)

Note that all math is directly stored as TeX. I would suggest to look at an
example document from the documentation to get an impression. The basic
stuff is easy (although you probably would need to parse the .layout files
as well). The nesting may be a bit tricky, though.

> I have some questions:
> 1) is there already a Ruby parser for LyX? ("Ruby" as in
> http://www.ruby-lang.org)

I don't know any.

> 2) is there a sacred document somewhere that defines the file format?

No. The format is defined in the source code.

> I could find this:
> http://www.lyx.org/trac/browser/lyx-devel/trunk/development/FORMAT
> which seems an increment log.

Exactly.

> 3) is this format "stable"? Will it change much in the upcoming 1.5
> version?

It never changes in the stable series (currently 1.4.x), but it may change
quite often in the devemlopment branch. At least one change will happen
before 1.5.0 is released, maybe more. If a document is in a wrong format
you can simply call lyx2lyx to convert it (this is what LyX itself does,
too).

> I was a little scared  by the changes found in development/FORMAT, and
> I'm starting to think that it would be easier to parse the generated
> TeX directly.

Definitely not. Proper TeX parsing is a nightmare.


Georg

Reply via email to