0
0
Fork 1
mirror of https://git.savannah.gnu.org/git/emacs/org-mode.git synced 2024-07-16 14:16:26 +00:00

ox.el: Rename `org-element-get-parent-element' and move to org-element

* lisp/org-element.el: Rename `org-element-get-parent-element' to
`org-element-parent-element'.
* lisp/org-compat.el (org-export-get-parent-element):
* lisp/ox.el (org-export-get-parent-element): Remove, adding obsolete
alias.
(org-export--skip-p):
* lisp/org-table.el:
* lisp/ox-beamer.el (org-beamer-link):
* lisp/ox-html.el (org-html-link):
* lisp/ox-latex.el (org-latex-footnote-reference):
* lisp/ox-md.el (org-md-link):
* lisp/ox-odt.el (org-odt-format-label):
(org-odt-link--inline-image):
(org-odt-link--inline-formula):
* lisp/ox-texinfo.el (org-texinfo--inline-image): Update all the
callers.
This commit is contained in:
Ihor Radchenko 2023-05-18 13:33:15 +02:00
parent ea4f4fdf58
commit 2d22d7f515
No known key found for this signature in database
GPG key ID: 6470762A7DA11D8B
10 changed files with 22 additions and 19 deletions

View file

@ -1134,7 +1134,10 @@ context. See the individual commands for more information."
(define-obsolete-function-alias 'ob-clojure-eval-with-babashka
#'ob-clojure-eval-with-cmd "9.7")
(define-obsolete-function-alias 'org-export-get-parent 'org-element-parent "9.7")
(define-obsolete-function-alias 'org-export-get-parent
'org-element-parent "9.7")
(define-obsolete-function-alias 'org-export-get-parent-element
'org-element-parent-element "9.7")
;;;; Obsolete link types

View file

@ -544,6 +544,11 @@ value of DATUM `:parent' property."
((org-element-secondary-p datum) 'object)
(t 'element)))))))
(defsubst org-element-parent-element (object)
"Return first element containing OBJECT or nil.
OBJECT is the object to consider."
(org-element-lineage object org-element-all-elements))
(defconst org-element--cache-element-properties
'(:cached
:org-element--cache-sync-key

View file

@ -5954,7 +5954,7 @@ information."
(let ((headerp ,(and (or hfmt hsep)
'(org-export-table-row-in-header-p
(org-export-get-parent-element cell) info)))
(org-element-parent-element cell) info)))
(column
;; Call costly `org-export-table-cell-address' only if
;; absolutely necessary, i.e., if one

View file

@ -740,7 +740,7 @@ used as a communication channel."
;; Fall-back to LaTeX export. However, prefer "\hyperlink" over
;; "\hyperref" since the former handles overlay specifications.
(let* ((latex-link (org-export-with-backend 'latex link contents info))
(parent (org-export-get-parent-element link))
(parent (org-element-parent-element link))
(attr (org-export-read-attribute :attr_beamer parent))
(overlay (plist-get attr :overlay)))
(cond ((string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link)

View file

@ -3247,7 +3247,7 @@ INFO is a plist holding contextual information. See
;; do this for the first link in parent (inner image link
;; for inline images). This is needed as long as
;; attributes cannot be set on a per link basis.
(let* ((parent (org-export-get-parent-element link))
(let* ((parent (org-element-parent-element link))
(link (let ((container (org-element-parent link)))
(if (and (org-element-type-p container 'link)
(org-html-inline-image-p link info))

View file

@ -2217,7 +2217,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
'(footnote-reference footnote-definition
table-cell verse-block))
(org-element-type-p
(org-export-get-parent-element footnote-reference) 'item))
(org-element-parent-element footnote-reference) 'item))
"\\footnotemark")
;; Otherwise, define it with \footnote command.
(t
@ -2708,7 +2708,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
"Return LaTeX code for an inline image.
LINK is the link pointing to the inline image. INFO is a plist
used as a communication channel."
(let* ((parent (org-export-get-parent-element link))
(let* ((parent (org-element-parent-element link))
(path (let ((raw-path (org-element-property :path link)))
(if (not (file-name-absolute-p raw-path)) raw-path
(expand-file-name raw-path))))

View file

@ -590,7 +590,7 @@ INFO is a plist holding contextual information. See
(t (expand-file-name raw-path))))
(caption (org-export-data
(org-export-get-caption
(org-export-get-parent-element link))
(org-element-parent-element link))
info)))
(format "![img](%s)"
(if (not (org-string-nw-p caption)) path

View file

@ -2081,7 +2081,7 @@ SHORT-CAPTION are strings."
(cl-assert (org-element-type-p element '(link table src-block paragraph)))
(let* ((element-or-parent
(cl-case (org-element-type element)
(link (org-export-get-parent-element element))
(link (org-element-parent-element element))
(t element)))
;; Get label and caption.
(label (and (or (org-element-property :name element)
@ -2259,7 +2259,7 @@ used as a communication channel."
(org-odt--copy-image-file src-expanded)))
;; Extract attributes from #+ATTR_ODT line.
(attr-from (cl-case (org-element-type element)
(link (org-export-get-parent-element element))
(link (org-element-parent-element element))
(t element)))
;; Convert attributes to a plist.
(attr-plist (org-export-read-attribute :attr_odt attr-from))
@ -2297,7 +2297,7 @@ used as a communication channel."
;; Check if this link was created by LaTeX-to-PNG converter.
(replaces (org-element-property
:replaces (if (not standalone-link-p) element
(org-export-get-parent-element element))))
(org-element-parent-element element))))
;; If yes, note down the type of the element - LaTeX Fragment
;; or LaTeX environment. It will go in to frame title.
(title (and replaces (capitalize
@ -2333,7 +2333,7 @@ used as a communication channel."
;; converter.
(replaces (org-element-property
:replaces (if (not standalone-link-p) element
(org-export-get-parent-element element))))
(org-element-parent-element element))))
;; If yes, note down the type of the element - LaTeX Fragment
;; or LaTeX environment. It will go in to frame title.
(title (and replaces (capitalize

View file

@ -1370,7 +1370,7 @@ INFO is a plist holding contextual information. See
"Return Texinfo code for an inline image.
LINK is the link pointing to the inline image. INFO is the
current state of the export, as a plist."
(let* ((parent (org-export-get-parent-element link))
(let* ((parent (org-element-parent-element link))
(label (and (org-element-property :name parent)
(org-texinfo--get-node parent info)))
(caption (org-export-get-caption parent))

View file

@ -1850,7 +1850,7 @@ not exported."
;; `:with-timestamps' only applies to isolated timestamps
;; objects, i.e. timestamp objects in a paragraph containing only
;; timestamps and whitespaces.
(when (let ((parent (org-export-get-parent-element datum)))
(when (let ((parent (org-element-parent-element datum)))
(and (org-element-type-p parent '(paragraph verse-block))
(not (org-element-map parent
(cons 'plain-text
@ -6031,7 +6031,7 @@ Return the new string."
;; Here are various functions to retrieve information about the
;; neighborhood of a given element or object. Neighbors of interest
;; are parent headline (`org-export-get-parent-headline'), first
;; element containing an object, (`org-export-get-parent-element'),
;; element containing an object, (`org-element-parent-element'),
;; parent table (`org-export-get-parent-table'), previous element or
;; object (`org-export-get-previous-element') and next element or
;; object (`org-export-get-next-element').
@ -6041,11 +6041,6 @@ Return the new string."
BLOB is the element or object being considered."
(org-element-lineage blob '(headline)))
(defun org-export-get-parent-element (object)
"Return first element containing OBJECT or nil.
OBJECT is the object to consider."
(org-element-lineage object org-element-all-elements))
(defun org-export-get-parent-table (object)
"Return OBJECT parent table or nil.
OBJECT is either a `table-cell' or `table-element' type object."