From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: Org mode and "shunt" exporters? Date: Thu, 12 Dec 2013 12:22:38 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b33cb7ea39f1904ed59971b Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39650) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr9yD-0006uR-UH for emacs-orgmode@gnu.org; Thu, 12 Dec 2013 12:22:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Vr9yC-0007Ew-5e for emacs-orgmode@gnu.org; Thu, 12 Dec 2013 12:22:41 -0500 Received: from mail-pd0-x236.google.com ([2607:f8b0:400e:c02::236]:64754) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Vr9yB-0007Eo-PU for emacs-orgmode@gnu.org; Thu, 12 Dec 2013 12:22:40 -0500 Received: by mail-pd0-f182.google.com with SMTP id v10so850878pde.41 for ; Thu, 12 Dec 2013 09:22:38 -0800 (PST) In-Reply-To: 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" --047d7b33cb7ea39f1904ed59971b Content-Type: text/plain; charset=ISO-8859-1 I wouldn't hold your breath waiting for my solution, it's currently a constructive procrastination project to see if it is possible ;) I made this: https://github.com/jkitchin/jmax/blob/prelude/ox-json.el which does give some output that vaguely resembles json for a very simple org-file (no quotes, no effort to make compliant json, or pretty print it, for example). This handles headlines, italic, bold text, links, paragraphs, and plain text. I don't have much need for this right now, so it will probably not advance much, but you might find it a starting point for you if the parse-tree doesn't pan out. John ----------------------------------- John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu On Thu, Dec 12, 2013 at 11:30 AM, Brett Viren wrote: > Hi John, > > John Kitchin writes: > > > that sounds like an interesting approach. xml seems like what you > > really want, since looking at the parsetree there is a lot of > > information (e.g. attributes, properties, etc...) that would be tricky > > to generate a fully representative json scheme. > > I see from your other thread that you are looking in to this idea of > dumping to JSON. That's great! If you want a tester of your JSON > exporter I'd be very happy to give it a try. If it means I can abandon > my own stumbling around, that would make me even happier. > > But, I am still slowly messing with this myself. I plan to next follow > Nicolas's suggestion of simply removing the :parent parameter to get > over the hurdle that the circular object caused me. I think if the > overall structure of the parse tree is preserved in the JSON then > parentage can be restored when it is read back. > > I've also thought a bit about schema issues. Regardless of how an "org > schema" might be represented, it would be best if it could be generated > From org instead of hand crafted. This would need a kind of a "meta > export" feature. I've not yet checked to see if there is some facility > in org to exploit to do this. Maybe someone knows? > > In the past I've expressed schema descriptions for JSON data in JSON > itself. Internet searches now show this is not a novel approach so I > think there is some fruit to be found pursuing this direction. Or, I > may just be trying too hard to avoid XML.... > > > This page suggests at the bottom you could export to texinfo, and > > convert that to docbook: > > http://orgmode.org/worg/exporters/ox-overview.html > > > > * (1) DocBook export, available in previous Org-mode versions, has not > > currently been ported to the new exporter, however the new > > ox-texinfo backend can generate DocBook format. Once file.texi is > > created via ox-texinfo, simply execute: > > > > makeinfo --docbook file.texi > > Thanks. I did try this but makeinfo failed on the texinfo file that was > produced. I didn't pursue it enough to figure out why or if I was doing > something wrong. > > -Brett. > --047d7b33cb7ea39f1904ed59971b Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I wouldn't hold your breath waiting for my soluti= on, it's currently a constructive procrastination project to see if it = is possible ;)

I made this:
which does give some output that vaguely resembles json for = a very simple org-file (no quotes, no effort to make compliant json, or pre= tty print it, for example). This handles headlines, italic, bold text, link= s, paragraphs, and plain text.

I don't have much need for this right now, so it will pr= obably not advance much, but you might find it a starting point for you if = the parse-tree doesn't pan out.



John

-----------------------------------
J= ohn Kitchin
Associate Professor
Doherty Hall A207F
Department of C= hemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213 412-268-7803
http://kitchingroup.cheme.cmu.edu



On Thu, Dec 12, 2013 at 11:30 AM, Brett = Viren <bv@bnl.gov> wrote:
Hi John,

John Kitchin <jkitchin@andrew= .cmu.edu> writes:

> that sounds like an interesting approach. xml seems like what you
> really want, since looking at the parsetree there is a lot of
> information (e.g. attributes, properties, etc...) that would be tricky=
> to generate a fully representative json scheme.

I see from your other thread that you are looking in to this idea of<= br> dumping to JSON. =A0That's great! =A0If you want a tester of your JSON<= br> exporter I'd be very happy to give it a try. =A0If it means I can aband= on
my own stumbling around, that would make me even happier.

But, I am still slowly messing with this myself. =A0I plan to next follow Nicolas's suggestion of simply removing the :parent parameter to get over the hurdle that the circular object caused me. =A0I think if the
overall structure of the parse tree is preserved in the JSON then
parentage can be restored when it is read back.

I've also thought a bit about schema issues. =A0Regardless of how an &q= uot;org
schema" might be represented, it would be best if it could be generate= d
>From org instead of hand crafted. =A0This would need a kind of a "meta=
export" feature. =A0I've not yet checked to see if there is some f= acility
in org to exploit to do this. =A0Maybe someone knows?

In the past I've expressed schema descriptions for JSON data in JSON itself. =A0Internet searches now show this is not a novel approach so I
think there is some fruit to be found pursuing this direction. =A0Or, I
may just be trying too hard to avoid XML....

> This page suggests at the bottom you could export to texinfo, and
> convert that to docbook:
> http://orgmode.org/worg/exporters/ox-overview.html
>
> * (1) DocBook export, available in previous Org-mode versions, h= as not
> =A0 currently been ported to the new exporter, howev= er the new
> =A0 ox-texinfo backend can generate DocBook format. Once file.texi is<= br> > =A0 created via ox-texinfo, simply execute:
>
> makeinfo --docbook file.texi

Thanks. =A0I did try this but makeinfo failed on the texinfo file tha= t was
produced. =A0I didn't pursue it enough to figure out why or if I was do= ing
something wrong.

-Brett.

--047d7b33cb7ea39f1904ed59971b--