From 0ee8ba3e0daa1214fb6d7349b8ee5db8f75a524e Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Fri, 16 Oct 2015 22:38:14 +0200 Subject: [PATCH] ox-beamer: Fix labels * lisp/ox-beamer.el (org-beamer--get-label): Remove protective braces when extracting label from options. (org-beamer--format-frame): Protect label with braces if it contains colons. Based off a patch from Fabrice Popineau (). --- lisp/ox-beamer.el | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/lisp/ox-beamer.el b/lisp/ox-beamer.el index 22bf53c4b..4db312e0f 100644 --- a/lisp/ox-beamer.el +++ b/lisp/ox-beamer.el @@ -331,13 +331,17 @@ channel." INFO is a plist used as a communication channel. The value is either the label specified in \"BEAMER_opt\" -property, or a fallback value built from headline's number. This -function assumes HEADLINE will be treated as a frame." +property, or a unique internal label. This function assumes +HEADLINE will be treated as a frame." (let ((opt (org-element-property :BEAMER_OPT headline))) (if (and (stringp opt) (string-match "\\(?:^\\|,\\)label=\\(.*?\\)\\(?:$\\|,\\)" opt)) - (match-string 1 opt) - (format "{sec:%s}" (org-export-get-reference headline info))))) + (let ((label (match-string 1 opt))) + ;; Strip protective braces, if any. + (if (org-string-match-p "\\`{.*}\\'" label) + (substring label 1 -1) + label)) + (format "sec:%s" (org-export-get-reference headline info))))) (defun org-beamer--frame-level (headline info) "Return frame level in subtree containing HEADLINE. @@ -441,8 +445,13 @@ used as a communication channel." (or (string-match "\\(^\\|,\\)label=" beamer-opt) (string-match "allowframebreaks" beamer-opt))) (list - (format "label=%s" - (org-beamer--get-label headline info))))))) + (let ((label (org-beamer--get-label headline info))) + ;; Labels containing colons need to be + ;; wrapped within braces. + (format (if (org-string-match-p ":" label) + "label={%s}" + "label=%s") + label))))))) ;; Change options list into a string. (org-beamer--normalize-argument (mapconcat -- 2.11.4.GIT