2013ko martxoak 6an, Bastien-ek idatzi zuen: > I'd suggest to treat org-link-abbrev-alist and locally defined > abbreviated links differently when opening the link at point and > when exporting the buffer. > > At expand time, the exporter could attach a list of export functions > (filters?) to the expanded link, depending on the local setting for > the abbreviated link or `org-link-abbrev-alist'. For example: > > #+LINK: cite file:my.bib::%s org-latex-bibtex-link > > (setq org-link-abbrev-alist > '(("cite" "file:my.bib::%s" 'org-latex-bibtex-link))) > > Then org-latex-bibtex-link would internally find the link, process > the BibTeX entry and return a sensible \cite{...} string. > > What do you think? I’m not sure I understand this proposal correctly. Specifically, the exporter needs to know to insert a link to the bib file in the header of the document (for BibLaTeX, this is the \addbibresource command); I’m not sure where that information would come from in this proposal: would the backend have to inspect the value of ‘org-link-abbrev-alist’? I’ve got some mostly-working code that exports citations, only for latex, using a different approach (similar to Eric’s). I’ve cleaned it up some, and attached it as a patch to this email. It uses the following syntax for links: [[type:key;pre;post][desc]]. I agree with Eric that an expanded syntax for encoding pre and post citation commands would be welcome. This code does insert the commands to load the bibtex file(s) into the document’s header. It shoudl support multiple bib files, as well as setting the file with an EXPORT_BIBLIOGRAPHY property on a subtree, though I haven’t tested either of those functions thoroughly. It also supports following a link to either a bibtex file or (if you manage your bibliography with org-bibtex) an org file. Things it doesn’t yet do: - automatically insert the latex code to print the bibliography (because I couldn’t think of a way to do this customizably enough – someone might want to have the bibliography at the end, not at the end, one bibliography per section, ...) - automatically insert the proper \usepackage into the header. I think the code should eventually do this, but Nicolas might disagree that that should instead go into org-latex-classes. Obviously this code needs work, but perhaps it can be a base on which to build. Supporting non-biblatex latex packages is an obvious low-hanging fruit. Support for HTML could probably come from citeproc-js (https://bitbucket.org/fbennett/citeproc-js/wiki/Home), but I will leave work on that to someone who is more familiar with HTML/JS/the ox-html backend than I.