emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* XML dump of org file?
@ 2016-09-21 21:52 Norman Walsh
  2016-09-22 16:07 ` Aaron Ecay
  0 siblings, 1 reply; 3+ messages in thread
From: Norman Walsh @ 2016-09-21 21:52 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1282 bytes --]

Hi,

There are various export filters, but I’d like one that just does a
complete, raw dump of the internal memory structure[*]. I could start
with something like the HTML export and work backwards to output other
tag names, but it seems like it should be possible to just dump the
data structure.

My brief couple-of-hours foray into this was unsuccessful. I ran
aground in various places where I couldn’t really grok the structure
well enough to deduce what to output. And possibly where my elisp
coding skills are a little weak.

Before I spend another few evenings poking it with a sharp stick, does
anyone have some code that walks the data structure in a way that will
make it easier? (Or has someone else, *gasp*, solved this exact
problem? :-))

                                        Be seeing you,
                                          norm

[*] I have really good XML tools for querying, transforming, and
otherwise manipulating the data. I want to start with as near to
perfect fidelity as I can. I don’t have any short term plans to try to
go the other way, but I might eventually.

-- 
Norman Walsh <ndw@nwalsh.com> | When we are tired, we are attacked by
http://nwalsh.com/            | ideas we conquered long ago.--Nietzsche

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 172 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: XML dump of org file?
  2016-09-21 21:52 XML dump of org file? Norman Walsh
@ 2016-09-22 16:07 ` Aaron Ecay
  2016-09-22 17:36   ` Brett Viren
  0 siblings, 1 reply; 3+ messages in thread
From: Aaron Ecay @ 2016-09-22 16:07 UTC (permalink / raw)
  To: Norman Walsh, emacs-orgmode

Hi Norman,

Have a look at the org-element library, which can produce an sexp
representation of the structure of an org document.  (In particular the
function ‘org-element-parse-buffer’).  You’ll need to convert the sexps
to XML, but that’s a comparatively minor task.

HTH,

-- 
Aaron Ecay

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: XML dump of org file?
  2016-09-22 16:07 ` Aaron Ecay
@ 2016-09-22 17:36   ` Brett Viren
  0 siblings, 0 replies; 3+ messages in thread
From: Brett Viren @ 2016-09-22 17:36 UTC (permalink / raw)
  To: Norman Walsh; +Cc: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 507 bytes --]

Aaron Ecay <aaronecay@gmail.com> writes:

> Have a look at the org-element library,

Just to add, there are circular dependencies in this data structure due
to ":parent" and potentially some of the ":structure" elements.  They
obviously need to be broken to avoid infinite loops.

Here my hackish attempt to deal with this in order to dump org-element
to JSON:

  https://github.com/brettviren/joyful-web/blob/master/joy/org2json.el

See org-json-straigten-tree for how I nullified these elements.

-Brett.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-22 18:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-21 21:52 XML dump of org file? Norman Walsh
2016-09-22 16:07 ` Aaron Ecay
2016-09-22 17:36   ` Brett Viren

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).