Re: [O] Parsing Org-mode in Python

2014-01-09 Thread Brett Viren
Hi Daniel, Daniel Clemente n142...@gmail.com writes: Are there already Python parsers for it? Parsing generic JSON is fairly trivial in Python. import json data = json.dumps(open('file.json').read()) The resulting data is then a bunch of Python lists and/or dicts matching whatever

Re: [O] Parsing Org-mode in Python

2014-01-08 Thread François Pinard
Brett Viren b...@bnl.gov writes: 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

Re: [O] Parsing Org-mode in Python

2014-01-08 Thread Brett Viren
François Pinard pin...@iro.umontreal.ca writes: Brett Viren b...@bnl.gov writes: http://permalink.gmane.org/gmane.emacs.orgmode/79838 This yields: , | Not Found | | The requested URL /gmane.emacs.orgmode/79838 was not found on this server. ` Huh, maybe a transient failure?

Re: [O] Parsing Org-mode in Python

2014-01-08 Thread François Pinard
2014/1/8 Brett Viren b...@bnl.gov Huh, maybe a transient failure? It's there for me right now. Here is the same message from GNU's archive: http://lists.gnu.org/archive/html/emacs-orgmode/2013-12/msg00415.html Got it, thanks! :-) -- François Pinard http://pinard.progiciels-bpi.ca

Re: [O] Parsing Org-mode in Python

2014-01-08 Thread Daniel Clemente
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

Re: [O] Parsing Org-mode in Python

2014-01-07 Thread Brett Viren
Hi Karl, Karl Voit devn...@karl-voit.at writes: Hi! * Daniel Clemente n142...@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

[O] Parsing Org-mode in Python (was: Implementing Org-mode tools in languages other than ELISP)

2014-01-06 Thread Karl Voit
Hi! * Daniel Clemente n142...@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

Re: [O] Parsing Org-mode in Python

2014-01-06 Thread François Pinard
Karl Voit devn...@karl-voit.at writes: I did not get the impression that [ply] is a parsing engine that is done the Python way. PLY has pros and cons. SPARK[1] always attracted me as being more elegant. While it accepts a wider set of grammars than PLY, SPARK can become quite slow on