Daimrod <daim...@gmail.com> writes: Why don't you just define how the link should be exported in your link definition?
for example: https://github.com/jkitchin/jmax/blob/master/org/org-ref.org#the-links You can see a link that is defined, with different export formats for different backends. I am intrigued by your function! It does not seem to work for all types of links though, for example I tried on on some file links, e.g. file:bib.bib, and [[file.bib]], but these fall in the (t data) case. [[file:bib.bib][bibliography]] on the other hand gets handled and you can access the element properties. I tried a similar approach on a table, but it did not work as I expected. Apparently the next property change puts you in a table-cell, rather than the parent table. I too am wondering if there is a defined way to get to the element properties within a filter function. For example, in this post http://kitchingroup.cheme.cmu.edu/blog/2014/09/22/Showing-what-data-went-into-a-code-block-on-export/ I concocted a preprocess scheme to get a list of table names, and then a filter function to put the names in the export on each table. It would be much more elegant to get it directly from the table element somehow. > Hi, > > I've wrote a simple filter to customize how links are exported in > latex: > > #+BEGIN_SRC > (defun dmd--latex-bib-link-filter (data backend info) > "Convert a bib link to a citation (e.g. bib:foo93 -> \cite{foo93})." > (let* ((beg (next-property-change 0 data)) > (link (if beg (get-text-property beg :parent data)))) > (cond ((and link > (org-export-derived-backend-p backend 'latex) > (string= (org-element-property :type link) "bib")) > (format "\\cite{%s}" (org-element-property :path link))) > ((and link > (org-export-derived-backend-p backend 'latex) > (string= (org-element-property :type link) "file") > (string= (org-element-property :path link) "~/.bib.bib")) > (format "\\cite{%s}" (org-element-property :search-option link))) > (t data)))) > #+END_SRC > > And I was wondering whether there is an easier way to retrieve the org > properties stored in the text properties of DATA. > > Best, -- ----------------------------------- John Kitchin Professor Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 http://kitchingroup.cheme.cmu.edu