diff options
author | Bastien Guerry <bzg@altern.org> | 2011-07-26 13:22:38 +0200 |
---|---|---|
committer | Bastien Guerry <bzg@altern.org> | 2011-07-26 13:22:38 +0200 |
commit | f0e4deb077fb91b4b09cf7fbb0c253c2ed443e24 (patch) | |
tree | 2886796ee51e039779420d685e59bab837da5624 | |
parent | 30dccb04bf7377167cf1ab88f1f649d1d948497e (diff) | |
download | org-mode-f0e4deb077fb91b4b09cf7fbb0c253c2ed443e24.tar.gz |
org-latex: allow `org-export-latex-href-format' to have only one "%s"
This is useful when you want to use \url{link} instead of the default
\href{link}{path}.
Thanks to Henri-Paul Indiogine for bringing this up.
* org-latex.el (org-export-latex-href-format): docstring fix
to reflect the fact that you can use only one "%s".
(org-export-latex-links): allow `org-export-latex-href-format'
to have only one "%s".
-rw-r--r-- | lisp/org-latex.el | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 2a5a9c3..0691437 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -304,8 +304,10 @@ markup defined, the first one in the association list will be used." (defcustom org-export-latex-href-format "\\href{%s}{%s}" "A printf format string to be applied to href links. -The format must contain two %s instances. The first will be filled with -the link, the second with the link description." +The format must contain either two %s instances or just one. +If it contains two %s instances, the first will be filled with +the link, the second with the link description. If it contains +only one, the %s will be filled with the link." :group 'org-export-latex :type 'string) @@ -2201,7 +2203,10 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." ;; a LaTeX issue, but we here implement a work-around anyway. (setq path (org-export-latex-protect-amp path) desc (org-export-latex-protect-amp desc))) - (insert (format org-export-latex-href-format path desc))) + (insert + (if (string-match "%s.*%s" org-export-latex-href-format) + (format org-export-latex-href-format path desc) + (format org-export-latex-href-format path)))) ((functionp (setq fnc (nth 2 (assoc type org-link-protocols)))) ;; The link protocol has a function for formatting the link |