emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Daimrod <daimrod@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Help on org-export-filter-link-functions
Date: Fri, 03 Oct 2014 13:19:31 +0200	[thread overview]
Message-ID: <87lhox2yf0.fsf@tanger.home> (raw)

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

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,

-- 
Daimrod/Greg

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

             reply	other threads:[~2014-10-03 11:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03 11:19 Daimrod [this message]
2014-10-04 16:40 ` Help on org-export-filter-link-functions John Kitchin
2014-10-05  1:13   ` Rasmus
2014-10-05 13:11     ` John Kitchin
2014-10-05 22:24       ` Rasmus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lhox2yf0.fsf@tanger.home \
    --to=daimrod@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).