lisp/ox-beamer.el: Add BEAMER_ACT to column definition

* ox-beamer.el (org-beamer--format-block): Process BEAMER_ACT if given
for column block.
This commit is contained in:
Eric S Fraga 2022-10-05 09:15:05 +01:00 committed by Ihor Radchenko
parent 13a8a74a99
commit c9ed0388e7
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 36 additions and 26 deletions

View File

@ -513,6 +513,18 @@ used as a communication channel."
(options (if raw-options
(org-beamer--normalize-argument raw-options 'option)
""))
;; also process actions
(raw-action (org-element-property :BEAMER_ACT headline))
(action (if raw-action
;; If BEAMER_act property has its value enclosed in square
;; brackets, it is a default overlay specification and
;; overlay specification is empty. Otherwise, it is an
;; overlay specification and the default one is nil.
(org-beamer--normalize-argument
raw-action
(if (string-match "\\`\\[.*\\]\\'" raw-action) 'defaction
'action))
""))
;; Start a "columns" environment when explicitly requested or
;; when there is no previous headline or the previous
;; headline do not have a BEAMER_column property.
@ -522,12 +534,12 @@ used as a communication channel."
(or (equal environment "columns")
(and column-width
(not (and parent-env
(equal (downcase parent-env) "columns")))
(equal (downcase parent-env) "columns")))
(or (org-export-first-sibling-p headline info)
(not (org-element-property
:BEAMER_COL
(org-export-get-previous-element
headline info)))))))
:BEAMER_COL
(org-export-get-previous-element
headline info)))))))
;; End the "columns" environment when explicitly requested or
;; when there is no next headline or the next headline do not
;; have a BEAMER_column property.
@ -535,11 +547,11 @@ used as a communication channel."
(or (equal environment "columns")
(and column-width
(not (and parent-env
(equal (downcase parent-env) "columns")))
(equal (downcase parent-env) "columns")))
(or (org-export-last-sibling-p headline info)
(not (org-element-property
:BEAMER_COL
(org-export-get-next-element headline info))))))))
:BEAMER_COL
(org-export-get-next-element headline info))))))))
(concat
(when start-columns-p
;; Column can accept options only when the environment is
@ -547,10 +559,13 @@ used as a communication channel."
(if (not (equal environment "columns")) "\\begin{columns}\n"
(format "\\begin{columns}%s\n" options)))
(when column-width
(format "\\begin{column}%s{%s}\n"
(format "\\begin{column}%s%s{%s}\n"
;; One can specify placement for column only when
;; HEADLINE stands for a column on its own.
(if (equal environment "column") options "")
options
(if env-format
"" ; Inner environment is specified - pass actions later.
action)
(format "%s\\columnwidth" column-width)))
;; Block's opening string.
(when (nth 2 env-format)
@ -558,23 +573,18 @@ used as a communication channel."
(org-fill-template
(nth 2 env-format)
(nconc
;; If BEAMER_act property has its value enclosed in square
;; brackets, it is a default overlay specification and
;; overlay specification is empty. Otherwise, it is an
;; overlay specification and the default one is nil.
(let ((action (org-element-property :BEAMER_ACT headline)))
(cond
((not action) (list (cons "a" "") (cons "A" "") (cons "R" "")))
((and (string-prefix-p "[" action)
(string-suffix-p "]" action))
(list
(cons "A" (org-beamer--normalize-argument action 'defaction))
(cons "a" "")
(cons "R" action)))
(t
(list (cons "a" (org-beamer--normalize-argument action 'action))
(cons "A" "")
(cons "R" action)))))
(cond
((not action) (list (cons "a" "") (cons "A" "") (cons "R" "")))
((and (string-prefix-p "[" action)
(string-suffix-p "]" action))
(list
(cons "A" (org-beamer--normalize-argument action 'defaction))
(cons "a" "")
(cons "R" raw-action)))
(t
(list (cons "a" action)
(cons "A" "")
(cons "R" raw-action))))
(list (cons "o" options)
(cons "O" (or raw-options ""))
(cons "h" title)