El Wed, 08 Jan 2014 10:42:17 -0500 Brett Viren va escriure: > > http://lists.gnu.org/archive/html/emacs-orgmode/2013-12/msg00415.html > > In any case, here is the salient chunk: > > #+BEGIN_SRC elisp > (require 'json) > (let* ((tree (org-element-parse-buffer 'object nil))) > (org-element-map tree (append org-element-all-elements > org-element-all-objects '(plain-text)) > (lambda (x) > (if (org-element-property :parent x) > (org-element-put-property x :parent "none")) > (if (org-element-property :structure x) > (org-element-put-property x :structure "none")) > )) > (write-region > (json-encode tree) > nil "foo.dat")) > #+END_SRC >
I like this very much. This output is much easier to parse than the source .org file, and it's still using the original Elisp parser (so you don't need a Python parser). I hope ox-json.el gets into org-mode some day. Are there already Python parsers for it? Should ox-json's output be as raw as possible (e.g. what your code produces now) or transformed to simpler JSON? (I think both formats should coexist).