From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Schulte Subject: Re: Org mode and "shunt" exporters? Date: Thu, 05 Dec 2013 19:10:00 -0700 Message-ID: <87zjoe7mf2.fsf@gmail.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:59663) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vokzu-0005Ls-Jf for emacs-orgmode@gnu.org; Thu, 05 Dec 2013 21:18:35 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vokzq-0006h1-1q for emacs-orgmode@gnu.org; Thu, 05 Dec 2013 21:18:30 -0500 Received: from mail-pb0-x236.google.com ([2607:f8b0:400e:c01::236]:45769) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vokzp-0006gx-R1 for emacs-orgmode@gnu.org; Thu, 05 Dec 2013 21:18:25 -0500 Received: by mail-pb0-f54.google.com with SMTP id un15so141271pbc.13 for ; Thu, 05 Dec 2013 18:18:25 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Brett Viren Cc: emacs-orgmode@gnu.org Brett Viren writes: > Has anyone written any new-style exporter which will produce a common > markup/data language format like JSON or YAML? I'm looking for > something that fully preserves the original org document structure and > does no semantic interpretation along the way. > > What I really want is to parse arbitrary org files in Python. I've > looked at the entries at worg's "org-tool" node which do this but they > seem out of date or make assumptions about what org elements exist or > their URLs are not loading (NEO). If any of that's a misrepresentation > please correct me. > > In any case, using org's own exporter to produce JSON or YAML and then > relying on these format's Python modules for parsing seems like the best > way to go to let me author in org and process in Python. > > I'm not very good with elisp (which is why I want to get org data into > Python) but I guess I can have a go at making such a "shunt" exporter. > Before I try, I just wanted to check if someone had this wheel already > spinning. > > Thanks, > -Brett. You can use `org-element-parse-buffer' to convert an Emacs Buffer to a structured Emacs Lisp object. At that point you can use existing tools for converting lisp to JSON or YAML. I've used cl-json for Common Lisp, I would imagine something similar exists for Emacs Lisp. -- Eric Schulte https://cs.unm.edu/~eschulte PGP: 0x614CA05D