ox-beamer: Do not add automatic label when "allowframebreaks" is set

* lisp/ox-beamer.el (org-beamer--format-frame): Do not add automatic
  label when "allowframebreaks" is set in default options.  Do not
  check only headline properties.
This commit is contained in:
Nicolas Goaziou 2018-10-20 10:51:06 +02:00
parent 9e05a6ac8a
commit 4a2e7c8db9
1 changed files with 25 additions and 24 deletions

View File

@ -424,9 +424,8 @@ used as a communication channel."
(let* ((beamer-opt (org-element-property :BEAMER_OPT headline)) (let* ((beamer-opt (org-element-property :BEAMER_OPT headline))
(options (options
;; Collect nonempty options from default value and ;; Collect nonempty options from default value and
;; headline's properties. Also add a label for ;; headline's properties.
;; links. (cl-remove-if-not #'org-string-nw-p
(cl-remove-if-not 'org-string-nw-p
(append (append
(org-split-string (org-split-string
(plist-get info :beamer-frame-default-options) ",") (plist-get info :beamer-frame-default-options) ",")
@ -436,29 +435,31 @@ used as a communication channel."
;; them. ;; them.
(and (string-match "^\\[?\\(.*\\)\\]?$" beamer-opt) (and (string-match "^\\[?\\(.*\\)\\]?$" beamer-opt)
(match-string 1 beamer-opt)) (match-string 1 beamer-opt))
",")) ",")))))
;; Provide an automatic label for the frame (fragile
;; unless the user specified one. Also refrain ;; Add "fragile" option if necessary.
;; from labeling `allowframebreaks' frames; this (and fragilep
;; is not allowed by beamer. (not (member "fragile" options))
(unless (and beamer-opt (list "fragile")))
(or (string-match "\\(^\\|,\\)label=" beamer-opt) (label
(string-match "allowframebreaks" beamer-opt))) ;; Provide an automatic label for the frame unless
(list ;; the user specified one. Also refrain from
(let ((label (org-beamer--get-label headline info))) ;; labeling `allowframebreaks' frames; this is not
;; Labels containing colons need to be ;; allowed by Beamer.
;; wrapped within braces. (and (not (member "allowframebreaks" options))
(format (if (string-match-p ":" label) (not (cl-some (lambda (s) (string-match-p "^label=" s))
"label={%s}" options))
"label=%s") (list
label)))))))) (let ((label (org-beamer--get-label headline info)))
;; Labels containing colons need to be
;; wrapped within braces.
(format (if (string-match-p ":" label)
"label={%s}"
"label=%s")
label))))))
;; Change options list into a string. ;; Change options list into a string.
(org-beamer--normalize-argument (org-beamer--normalize-argument
(mapconcat (mapconcat #'identity (append label fragile options) ",")
'identity
(if (or (not fragilep) (member "fragile" options)) options
(cons "fragile" options))
",")
'option)) 'option))
;; Title. ;; Title.
(let ((env (org-element-property :BEAMER_ENV headline))) (let ((env (org-element-property :BEAMER_ENV headline)))