summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-09-16 09:24:32 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-09-16 09:25:31 +0200
commita99402facf87269d349795b576d5f56aba1c550d (patch)
tree5c0a7b5aa10a8918b4fe6a1f071550c80f36bc24
parenta5756f5e1d5f4b314a3f5af5bb611a15d7fe4efb (diff)
downloadorg-mode-a99402facf87269d349795b576d5f56aba1c550d.tar.gz
org-e-latex: Consistently change label names
* contrib/lisp/org-e-latex.el (org-e-latex--caption/label-string, org-e-latex--wrap-label, org-e-latex-latex-environment): Consistently call `org-export-solidify-link-text' so references can match labels.
-rw-r--r--contrib/lisp/org-e-latex.el16
1 files changed, 9 insertions, 7 deletions
diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el
index f184d9c..b90a097 100644
--- a/contrib/lisp/org-e-latex.el
+++ b/contrib/lisp/org-e-latex.el
@@ -848,12 +848,14 @@ caption nor label, return the empty string.
For non-floats, see `org-e-latex--wrap-label'."
(let* ((label (org-element-property :name element))
- (label-str (if label (format "\\label{%s}" label) ""))
+ (label-str (if (not (org-string-nw-p label)) ""
+ (format "\\label{%s}"
+ (org-export-solidify-link-text label))))
(main (org-export-get-caption element))
(short (org-export-get-caption element t)))
(cond
- ((and (not main) (not label)) "")
- ((not main) (format "\\label{%s}\n" label))
+ ((and (not main) (equal label-str "")) "")
+ ((not main) (concat label-str "\n"))
;; Option caption format with short name.
(short (format "\\caption[%s]{%s%s}\n"
(org-export-data short info)
@@ -944,9 +946,9 @@ is a plist used as a communication channel."
This function shouldn't be used for floats. See
`org-e-latex--caption/label-string'."
(let ((label (org-element-property :name element)))
- (if (or (not output) (not label) (string= output "") (string= label ""))
- output
- (concat (format "\\label{%s}\n" label) output))))
+ (if (not (and (org-string-nw-p output) (org-string-nw-p label))) output
+ (concat (format "\\label{%s}\n" (org-export-solidify-link-text label))
+ output))))
(defun org-e-latex--text-markup (text markup)
"Format TEXT depending on MARKUP text markup.
@@ -1685,7 +1687,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
(insert value)
(goto-char (point-min))
(forward-line)
- (insert (format "\\label{%s}\n" label))
+ (insert (format "\\label{%s}\n" (org-export-solidify-link-text label)))
(buffer-string)))))