From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: How to extract raw link and description from the "link" element? Date: Mon, 23 Feb 2015 19:56:54 -0500 Message-ID: References: <87ioesm9sh.fsf@wmi.amu.edu.pl> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQ3o5-00063R-UN for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 19:57:02 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YQ3o0-0007qI-Uj for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 19:57:01 -0500 Received: from smtp.andrew.cmu.edu ([128.2.105.204]:38121) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YQ3o0-0007q8-Pd for emacs-orgmode@gnu.org; Mon, 23 Feb 2015 19:56:56 -0500 In-reply-to: <87ioesm9sh.fsf@wmi.amu.edu.pl> 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: Marcin Borkowski Cc: Org-Mode mailing list Probably there is some more elegant way but if you run this on a link, you get the two pieces I think. In a filter or exporter, you might replace (org-element-context) with the link element/object #+BEGIN_SRC emacs-lisp (defun parse-link () (interactive) (message-box "%s" (cons ;; path (org-element-property :path (org-element-context)) ;; description (buffer-substring (org-element-property :contents-begin (org-element-context)) (org-element-property :contents-end (org-element-context)))))) #+END_SRC Marcin Borkowski writes: > Hi all, > > so I have this: > > [[file:whatever.org][Some link]] > > How do I extract bith parts of this link programmatically? > > My use case is that I have an Org tree of links, and I want to export > them to certain XML format. > > TIA, -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu