LaTeX export: Use special formatting by link type interface

Patch by Christian Moe, who writes:

> It looks like support for formatting custom link types in LaTeX export
> is broken?
>
> I was trying to implement a custom link type with its own formatting
> function for HTML and LaTeX export, following the steps in
> org-bbdb.el.
>
> I've found that org-bbdb-export does not italicize bbdb links in
> LaTeX, nor does my own org-cite-export turn my custom =cite:= links
> into LaTeX =\cite{}= citations. Everything works fine in HTML export,
> but in LaTeX all custom link types get formatted as =\texttt{descr}=.
>
> I see that org-export-as-html and org-export-as-docbook look up
> org-link-protocols to get the function for formatting the link, but it
> seems that org-export-as-latex doesn't.
>
>
This commit is contained in:
Carsten Dominik 2010-05-12 15:14:17 +02:00
parent 336456d0c3
commit 8a671f8d4d
2 changed files with 11 additions and 1 deletions

View File

@ -1,5 +1,8 @@
2010-05-12 Carsten Dominik <carsten.dominik@gmail.com>
* org-latex.el (org-export-latex-links): Use the formatting
function of the link type, if it is available.
* org-table.el (org-table-get-remote-range): Return to
original buffer when retrieving remote reference.

View File

@ -1822,7 +1822,7 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(attr (or (org-find-text-property-in-string 'org-attributes raw-path)
(plist-get org-export-latex-options-plist :latex-image-options)))
(label (org-find-text-property-in-string 'org-label raw-path))
imgp radiop
imgp radiop fnc
;; define the path of the link
(path (cond
((member type '("coderef"))
@ -1876,6 +1876,13 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
(setq path (org-export-latex-protect-amp path)
desc (org-export-latex-protect-amp desc)))
(insert (format org-export-latex-hyperref-format path desc)))
((functionp (setq fnc (nth 2 (assoc type org-link-protocols))))
;; The link protocol has a function for formatting the link
(insert
(save-match-data
(funcall fnc (org-link-unescape raw-path) desc 'latex))))
(t (insert "\\texttt{" desc "}")))))))