emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Brett Viren <bv@bnl.gov>
To: news1142@Karl-Voit.at
Cc: emacs-orgmode@gnu.org
Subject: Re: Parsing Org-mode in Python
Date: Tue, 07 Jan 2014 11:09:35 -0500	[thread overview]
Message-ID: <ir4zjn7n58g.fsf@lycastus.phy.bnl.gov> (raw)
In-Reply-To: <2014-01-06T11-23-40@devnull.Karl-Voit.at> (Karl Voit's message of "Mon, 6 Jan 2014 11:44:40 +0100")

[-- Attachment #1: Type: text/plain, Size: 1899 bytes --]

Hi Karl,

Karl Voit <devnull@Karl-Voit.at> writes:

> Hi!
> * Daniel Clemente <n142857@gmail.com> 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:


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.


[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2014-01-07 16:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-22 16:37 Converting org-mode/org-contacts to VCard (importing to Android) Karl Voit
2013-11-22 16:54 ` Rüdiger Sonderfeld
2013-11-22 17:09   ` Karl Voit
2013-11-23  0:00     ` Rüdiger Sonderfeld
2013-11-24 13:06       ` Implementing Org-mode tools in languages other than ELISP (was: Converting org-mode/org-contacts to VCard (importing to Android)) Karl Voit
2014-01-04 14:58         ` Implementing Org-mode tools in languages other than ELISP Bastien
2014-01-04 16:43           ` François Pinard
2014-01-05 16:43             ` Daniel Clemente
2014-01-06 10:44               ` Parsing Org-mode in Python (was: Implementing Org-mode tools in languages other than ELISP) Karl Voit
2014-01-07  2:33                 ` Parsing Org-mode in Python François Pinard
2014-01-07 16:09                 ` Brett Viren [this message]
2014-01-08 12:33                   ` François Pinard
2014-01-08 15:42                     ` Brett Viren
2014-01-08 16:11                       ` François Pinard
2014-01-09  4:13                       ` Daniel Clemente
2014-01-09 14:13                         ` Brett Viren
2014-01-07  1:47               ` Implementing Org-mode tools in languages other than ELISP François Pinard
2013-11-23  8:36     ` Converting org-mode/org-contacts to VCard (importing to Android) Feng Shu
2013-11-23  8:29 ` Feng Shu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ir4zjn7n58g.fsf@lycastus.phy.bnl.gov \
    --to=bv@bnl.gov \
    --cc=emacs-orgmode@gnu.org \
    --cc=news1142@Karl-Voit.at \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).