From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Abrahamsen Subject: Re: the "right way" to build OMPL export and import Date: Fri, 26 Apr 2013 14:30:58 -0700 Message-ID: <87y5c5ou7h.fsf@ericabrahamsen.net> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVq8d-0006WZ-OK for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 17:25:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UVq8b-0005qi-MQ for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 17:25:03 -0400 Received: from plane.gmane.org ([80.91.229.3]:36387) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UVq8b-0005pt-FW for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 17:25:01 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UVq8U-00019I-LS for emacs-orgmode@gnu.org; Fri, 26 Apr 2013 23:24:54 +0200 Received: from 63.226.249.211 ([63.226.249.211]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Apr 2013 23:24:54 +0200 Received: from eric by 63.226.249.211 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 26 Apr 2013 23:24:54 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Alexis Gallagher writes: > Hi, > > I would love to be able to export org documents to opal, so that I can > read them with the various commercial outlining apps on platforms > without emacs -- e.g, iOS. The ideal thing would be if I could import > OPML as well. > > Is anyone working on this already? > > If not, does anyone have any pointers on the "right way" to go about > this, so that the work would go smoothly and be acceptable upstream? > This seems like a good time to ask given the recent consolidation of > export facilities around the internal parser org-element.el. > > I presume any OPML exporter should be based on that, correct? Is any one of the existing exporters a particularly clean example to work from? > > For OPML import, is org-element-interpret-data the best starting point? > > Alexis Hi Alexis, I guess the first step to making an OPML exporter would be figuring out how to export correctly to XML, which happens to be something I've spent a whole fourteen minutes thinking about. I'm not sure the general export engine is going to be of much use, since XML is so completely flexible, but you'll definitely want to build it on top of the internal parser. Luckily, the parser turns an org subtree into a parse tree, and the function `xml-print' turns a parse tree into XML. They're not quite the same parse tree, but I guess you'll want to do something like this: #+BEGIN_SRC org ,* My Great Playlist ,** The Cold Cold Ground.mp3 :PROPERTIES: :OPML_TYPE: song :OPML_F: Tom Waits - The Cold Cold Ground :END: ,** Don't Eat the Yellow Snow.mp3 :PROPERTIES: :OPML_TYPE: song :OPML_F: Frank Zappa - Don't Eat the Yellow Snow :END: #+END_SRC | | org-element--parse-elements | | #+BEGIN_SRC emacs-lisp (org-data (headline "My Great Playlist" (etc, snipped because printing this makes a huge mess) #+END_SRC | | magic-happens-here | | #+BEGIN_SRC emacs-lisp (outline ((text . "My Great Playlist")) (outline ((text . "The Cold Cold Ground.mp3") (type . "song") (f . "Tom Waits - The Cold Cold Ground"))) (outline ((text . "Don't Eat the Yellow Snow.mp3") (type . "song") (f . "Frank Zappa - Don't Eat the Yellow Snow")))) #+END_SRC | | xml-print | | #+BEGIN_SRC xml #+END_SRC It's the magic that will take some doing, though! Eric