emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] Parsing Org-mode in Python


From: Brett Viren
Subject: Re: [O] Parsing Org-mode in Python
Date: Tue, 07 Jan 2014 11:09:35 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Hi Karl,

Karl Voit <address@hidden> writes:

> Hi!
>
> * Daniel Clemente <address@hidden> wrote:
>>> 
>>> I dream of having a general Python parser for Org mode files, knowing
>>> every bit about the current syntax for Org files, surrounded by enough
>>> Python machinery to make it useful.
>
> Oh, this would be great since there are way more Python-coders out
> there as ELISP coders.

I agree.

I'm also (slowly) working toward some Python-based org processing.  My
strategy is to produce an intermediate file in JSON format which is
designed to capture the full org document structure.  I am calling this
a "shunt" export as it is meant to do as little interpretation of the
document as possible.

If this is interesting to you and you haven't already seen it please
check the thread from December were I got a lot of help to output this
JSON via the new org export mechanism (I'm a LISP newbie).  Here is the
concluding post with a working example:

  http://permalink.gmane.org/gmane.emacs.orgmode/79838

Besides any eventual Python-side development, one remaining gap in my
plan is how to produce some kind of schema description using the org
exporter machinery.  I want to have this description generated
automatically so that any future changes to the org format can be
accommodated with some level of automation.

So, my current thinking is to find a way to exploit org export machinery
to generate this schema (call it a "meta-shunt" export?).  If I can find
that I'll output it as another JSON file.  Then, on the Python-side, I
will read this schema file in and generate instances of
collections.namedtuple.  Finally a reader of the JSON org document will
be developed to produce objects of these namedtuple classes.

At the end of the day one will have a DOM-style data structure
representing the initial org document.

-Brett.

Attachment: pgp8v67W2fiiR.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]