mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-08-24 22:32:53 +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:
parent
ea4f4fdf58
commit
2d22d7f515
|
@ -1134,7 +1134,10 @@ context. See the individual commands for more information."
|
||||||
(define-obsolete-function-alias 'ob-clojure-eval-with-babashka
|
(define-obsolete-function-alias 'ob-clojure-eval-with-babashka
|
||||||
#'ob-clojure-eval-with-cmd "9.7")
|
#'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
|
;;;; Obsolete link types
|
||||||
|
|
||||||
|
|
|
@ -544,6 +544,11 @@ value of DATUM `:parent' property."
|
||||||
((org-element-secondary-p datum) 'object)
|
((org-element-secondary-p datum) 'object)
|
||||||
(t 'element)))))))
|
(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
|
(defconst org-element--cache-element-properties
|
||||||
'(:cached
|
'(:cached
|
||||||
:org-element--cache-sync-key
|
:org-element--cache-sync-key
|
||||||
|
|
|
@ -5954,7 +5954,7 @@ information."
|
||||||
|
|
||||||
(let ((headerp ,(and (or hfmt hsep)
|
(let ((headerp ,(and (or hfmt hsep)
|
||||||
'(org-export-table-row-in-header-p
|
'(org-export-table-row-in-header-p
|
||||||
(org-export-get-parent-element cell) info)))
|
(org-element-parent-element cell) info)))
|
||||||
(column
|
(column
|
||||||
;; Call costly `org-export-table-cell-address' only if
|
;; Call costly `org-export-table-cell-address' only if
|
||||||
;; absolutely necessary, i.e., if one
|
;; absolutely necessary, i.e., if one
|
||||||
|
|
|
@ -740,7 +740,7 @@ used as a communication channel."
|
||||||
;; Fall-back to LaTeX export. However, prefer "\hyperlink" over
|
;; Fall-back to LaTeX export. However, prefer "\hyperlink" over
|
||||||
;; "\hyperref" since the former handles overlay specifications.
|
;; "\hyperref" since the former handles overlay specifications.
|
||||||
(let* ((latex-link (org-export-with-backend 'latex link contents info))
|
(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))
|
(attr (org-export-read-attribute :attr_beamer parent))
|
||||||
(overlay (plist-get attr :overlay)))
|
(overlay (plist-get attr :overlay)))
|
||||||
(cond ((string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link)
|
(cond ((string-match "\\`\\\\hyperref\\[\\(.*?\\)\\]" latex-link)
|
||||||
|
|
|
@ -3247,7 +3247,7 @@ INFO is a plist holding contextual information. See
|
||||||
;; do this for the first link in parent (inner image link
|
;; do this for the first link in parent (inner image link
|
||||||
;; for inline images). This is needed as long as
|
;; for inline images). This is needed as long as
|
||||||
;; attributes cannot be set on a per link basis.
|
;; 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)))
|
(link (let ((container (org-element-parent link)))
|
||||||
(if (and (org-element-type-p container 'link)
|
(if (and (org-element-type-p container 'link)
|
||||||
(org-html-inline-image-p link info))
|
(org-html-inline-image-p link info))
|
||||||
|
|
|
@ -2217,7 +2217,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
'(footnote-reference footnote-definition
|
'(footnote-reference footnote-definition
|
||||||
table-cell verse-block))
|
table-cell verse-block))
|
||||||
(org-element-type-p
|
(org-element-type-p
|
||||||
(org-export-get-parent-element footnote-reference) 'item))
|
(org-element-parent-element footnote-reference) 'item))
|
||||||
"\\footnotemark")
|
"\\footnotemark")
|
||||||
;; Otherwise, define it with \footnote command.
|
;; Otherwise, define it with \footnote command.
|
||||||
(t
|
(t
|
||||||
|
@ -2708,7 +2708,7 @@ CONTENTS is nil. INFO is a plist holding contextual information."
|
||||||
"Return LaTeX code for an inline image.
|
"Return LaTeX code for an inline image.
|
||||||
LINK is the link pointing to the inline image. INFO is a plist
|
LINK is the link pointing to the inline image. INFO is a plist
|
||||||
used as a communication channel."
|
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)))
|
(path (let ((raw-path (org-element-property :path link)))
|
||||||
(if (not (file-name-absolute-p raw-path)) raw-path
|
(if (not (file-name-absolute-p raw-path)) raw-path
|
||||||
(expand-file-name raw-path))))
|
(expand-file-name raw-path))))
|
||||||
|
|
|
@ -590,7 +590,7 @@ INFO is a plist holding contextual information. See
|
||||||
(t (expand-file-name raw-path))))
|
(t (expand-file-name raw-path))))
|
||||||
(caption (org-export-data
|
(caption (org-export-data
|
||||||
(org-export-get-caption
|
(org-export-get-caption
|
||||||
(org-export-get-parent-element link))
|
(org-element-parent-element link))
|
||||||
info)))
|
info)))
|
||||||
(format "![img](%s)"
|
(format "![img](%s)"
|
||||||
(if (not (org-string-nw-p caption)) path
|
(if (not (org-string-nw-p caption)) path
|
||||||
|
|
|
@ -2081,7 +2081,7 @@ SHORT-CAPTION are strings."
|
||||||
(cl-assert (org-element-type-p element '(link table src-block paragraph)))
|
(cl-assert (org-element-type-p element '(link table src-block paragraph)))
|
||||||
(let* ((element-or-parent
|
(let* ((element-or-parent
|
||||||
(cl-case (org-element-type element)
|
(cl-case (org-element-type element)
|
||||||
(link (org-export-get-parent-element element))
|
(link (org-element-parent-element element))
|
||||||
(t element)))
|
(t element)))
|
||||||
;; Get label and caption.
|
;; Get label and caption.
|
||||||
(label (and (or (org-element-property :name element)
|
(label (and (or (org-element-property :name element)
|
||||||
|
@ -2259,7 +2259,7 @@ used as a communication channel."
|
||||||
(org-odt--copy-image-file src-expanded)))
|
(org-odt--copy-image-file src-expanded)))
|
||||||
;; Extract attributes from #+ATTR_ODT line.
|
;; Extract attributes from #+ATTR_ODT line.
|
||||||
(attr-from (cl-case (org-element-type element)
|
(attr-from (cl-case (org-element-type element)
|
||||||
(link (org-export-get-parent-element element))
|
(link (org-element-parent-element element))
|
||||||
(t element)))
|
(t element)))
|
||||||
;; Convert attributes to a plist.
|
;; Convert attributes to a plist.
|
||||||
(attr-plist (org-export-read-attribute :attr_odt attr-from))
|
(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.
|
;; Check if this link was created by LaTeX-to-PNG converter.
|
||||||
(replaces (org-element-property
|
(replaces (org-element-property
|
||||||
:replaces (if (not standalone-link-p) element
|
: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
|
;; If yes, note down the type of the element - LaTeX Fragment
|
||||||
;; or LaTeX environment. It will go in to frame title.
|
;; or LaTeX environment. It will go in to frame title.
|
||||||
(title (and replaces (capitalize
|
(title (and replaces (capitalize
|
||||||
|
@ -2333,7 +2333,7 @@ used as a communication channel."
|
||||||
;; converter.
|
;; converter.
|
||||||
(replaces (org-element-property
|
(replaces (org-element-property
|
||||||
:replaces (if (not standalone-link-p) element
|
: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
|
;; If yes, note down the type of the element - LaTeX Fragment
|
||||||
;; or LaTeX environment. It will go in to frame title.
|
;; or LaTeX environment. It will go in to frame title.
|
||||||
(title (and replaces (capitalize
|
(title (and replaces (capitalize
|
||||||
|
|
|
@ -1370,7 +1370,7 @@ INFO is a plist holding contextual information. See
|
||||||
"Return Texinfo code for an inline image.
|
"Return Texinfo code for an inline image.
|
||||||
LINK is the link pointing to the inline image. INFO is the
|
LINK is the link pointing to the inline image. INFO is the
|
||||||
current state of the export, as a plist."
|
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)
|
(label (and (org-element-property :name parent)
|
||||||
(org-texinfo--get-node parent info)))
|
(org-texinfo--get-node parent info)))
|
||||||
(caption (org-export-get-caption parent))
|
(caption (org-export-get-caption parent))
|
||||||
|
|
|
@ -1850,7 +1850,7 @@ not exported."
|
||||||
;; `:with-timestamps' only applies to isolated timestamps
|
;; `:with-timestamps' only applies to isolated timestamps
|
||||||
;; objects, i.e. timestamp objects in a paragraph containing only
|
;; objects, i.e. timestamp objects in a paragraph containing only
|
||||||
;; timestamps and whitespaces.
|
;; 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))
|
(and (org-element-type-p parent '(paragraph verse-block))
|
||||||
(not (org-element-map parent
|
(not (org-element-map parent
|
||||||
(cons 'plain-text
|
(cons 'plain-text
|
||||||
|
@ -6031,7 +6031,7 @@ Return the new string."
|
||||||
;; Here are various functions to retrieve information about the
|
;; Here are various functions to retrieve information about the
|
||||||
;; neighborhood of a given element or object. Neighbors of interest
|
;; neighborhood of a given element or object. Neighbors of interest
|
||||||
;; are parent headline (`org-export-get-parent-headline'), first
|
;; 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
|
;; parent table (`org-export-get-parent-table'), previous element or
|
||||||
;; object (`org-export-get-previous-element') and next element or
|
;; object (`org-export-get-previous-element') and next element or
|
||||||
;; object (`org-export-get-next-element').
|
;; object (`org-export-get-next-element').
|
||||||
|
@ -6041,11 +6041,6 @@ Return the new string."
|
||||||
BLOB is the element or object being considered."
|
BLOB is the element or object being considered."
|
||||||
(org-element-lineage blob '(headline)))
|
(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)
|
(defun org-export-get-parent-table (object)
|
||||||
"Return OBJECT parent table or nil.
|
"Return OBJECT parent table or nil.
|
||||||
OBJECT is either a `table-cell' or `table-element' type object."
|
OBJECT is either a `table-cell' or `table-element' type object."
|
||||||
|
|
Loading…
Reference in a new issue