[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] How to extract raw link and description from the "link" element?
From: |
John Kitchin |
Subject: |
Re: [O] How to extract raw link and description from the "link" element? |
Date: |
Mon, 23 Feb 2015 19:56:54 -0500 |
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