Re: [O] Org mode and "shunt" exporters?

2013-12-13 Thread Brett Viren
Hi Eric, Eric Schulte writes: > This should work in a recent Emacs. > > (require 'json) > (defun org-as-json-to-file (&optional path) > "Export the current Org-mode buffer as JSON to the supplied PATH." > (interactive "Fwrite to file: ") > (let ((tree (org-element-parse

Re: [O] Org mode and "shunt" exporters?

2013-12-13 Thread Eric Schulte
This should work in a recent Emacs. (require 'json) (defun org-as-json-to-file (&optional path) "Export the current Org-mode buffer as JSON to the supplied PATH." (interactive "Fwrite to file: ") (let ((tree (org-element-parse-buffer))) (org-element-map tree

Re: [O] Org mode and "shunt" exporters?

2013-12-13 Thread Nicolas Goaziou
Hello, Brett Viren writes: > However this method only works for a very simple org document. I'm > successfully filtering out the :parent properties of (most of) the > elements but as soon as my document produces a plain text element like: > > #("Text" 0 4 (:parent #1)) > > then two problems o

Re: [O] Org mode and "shunt" exporters?

2013-12-13 Thread Brett Viren
Matt Price writes: > I am pretty ignorant and may have missed a referene o this in the > thread, but this (very outdated) code is on the emacswiki: > > http://www.emacswiki.org/emacs/org-json.el Thanks. My searches didn't find this. It looks like this is parsing the org buffer directly and onl

Re: [O] Org mode and "shunt" exporters?

2013-12-13 Thread Brett Viren
Hi, Nicolas Goaziou writes: > You can walk the tree, e.g. with `org-element-map', and remove > all :parent references if you don't need them. I figured out how to follow this advice. I can even make valid JSON From the filtered parse tree by handing it to Edward O'Conner's json.el (link in exa

Re: [O] Org mode and "shunt" exporters?

2013-12-12 Thread John Kitchin
I tried this code but I get a JSON readtable error even with the examples in the code. John --- John Kitchin Associate Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.c

Re: [O] Org mode and "shunt" exporters?

2013-12-12 Thread Matt Price
On Thu, Dec 12, 2013 at 2:50 PM, Aaron Ecay wrote: > 2013ko abenudak 12an, John Kitchin-ek idatzi zuen: >> >> 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/jkitch

Re: [O] Org mode and "shunt" exporters?

2013-12-12 Thread Aaron Ecay
2013ko abenudak 12an, John Kitchin-ek idatzi zuen: > > 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 outp

Re: [O] Org mode and "shunt" exporters?

2013-12-12 Thread Eric Schulte
Here's a quick shot at using Common Lisp's cl-json package as a bridge between Emacs-lisp and JSON. The Org-mode file with necessary the code is attached (it requires a running lisp process w/cl-json loaded), as well as it's json conversion. #+Title: Org to JSON Use Common Lisp as a bridge betwe

Re: [O] Org mode and "shunt" exporters?

2013-12-12 Thread John Kitchin
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 quot

Re: [O] Org mode and "shunt" exporters?

2013-12-12 Thread Brett Viren
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 fro

Re: [O] Org mode and "shunt" exporters?

2013-12-09 Thread Nicolas Goaziou
Hello, Brett Viren writes: > Eric Schulte writes: > >> 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

Re: [O] Org mode and "shunt" exporters?

2013-12-09 Thread Brett Viren
Eric Schulte writes: > 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 L

Re: [O] Org mode and "shunt" exporters?

2013-12-06 Thread John Kitchin
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. This page suggests at the bottom you could export t

Re: [O] Org mode and "shunt" exporters?

2013-12-05 Thread Eric Schulte
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

[O] Org mode and "shunt" exporters?

2013-12-05 Thread Brett Viren
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 f