[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Parsing Org-mode in Python
From: |
Brett Viren |
Subject: |
Re: [O] Parsing Org-mode in Python |
Date: |
Wed, 08 Jan 2014 10:42:17 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
François Pinard <address@hidden> writes:
> Brett Viren <address@hidden> 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? 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
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
This test is meant to run from inside an org-mode buffer which itself
provides the fodder for the test. But, it shows the steps that I'll
need to integrate into some new org export mechanism. The important
part is nulling out the :parent and :structure (and maybe others?)
properties in order to break their circular references. The heavy
lifting is all in org-element-parse-buffer and json-encode.
>> At the end of the day one will have a DOM-style data structure
>> representing the initial org document.
>
> Keep me (us!) posted! :-)
Definitely!
-Brett.
pgpz73osTSz1o.pgp
Description: PGP signature
- Re: [O] Implementing Org-mode tools in languages other than ELISP, Bastien, 2014/01/04
- Re: [O] Implementing Org-mode tools in languages other than ELISP, François Pinard, 2014/01/04
- Re: [O] Implementing Org-mode tools in languages other than ELISP, Daniel Clemente, 2014/01/05
- [O] Parsing Org-mode in Python (was: Implementing Org-mode tools in languages other than ELISP), Karl Voit, 2014/01/06
- Re: [O] Parsing Org-mode in Python, François Pinard, 2014/01/06
- Re: [O] Parsing Org-mode in Python, Brett Viren, 2014/01/07
- Re: [O] Parsing Org-mode in Python, François Pinard, 2014/01/08
- Re: [O] Parsing Org-mode in Python,
Brett Viren <=
- Re: [O] Parsing Org-mode in Python, François Pinard, 2014/01/08
- Re: [O] Parsing Org-mode in Python, Daniel Clemente, 2014/01/08
- Re: [O] Parsing Org-mode in Python, Brett Viren, 2014/01/09
- Re: [O] Implementing Org-mode tools in languages other than ELISP, François Pinard, 2014/01/06