Function: org-html-standalone-image-p
org-html-standalone-image-p is a byte-compiled function defined in
ox-html.el.gz.
Signature
(org-html-standalone-image-p ELEMENT INFO)
Documentation
Non-nil if ELEMENT is a standalone image.
INFO is a plist holding contextual information.
An element or object is a standalone image when
- its type is paragraph and its sole content, save for white
spaces, is a link that qualifies as an inline image;
- its type is link and its containing paragraph has no other
content save white spaces.
Bind org-html-standalone-image-predicate to constrain paragraph
further. For example, to check for only captioned standalone
images, set it to:
(lambda (paragraph) (org-element-property :caption paragraph))
Source Code
;; Defined in /usr/src/emacs/lisp/org/ox-html.el.gz
(defun org-html-standalone-image-p (element info)
"Non-nil if ELEMENT is a standalone image.
INFO is a plist holding contextual information.
An element or object is a standalone image when
- its type is `paragraph' and its sole content, save for white
spaces, is a link that qualifies as an inline image;
- its type is `link' and its containing paragraph has no other
content save white spaces.
Bind `org-html-standalone-image-predicate' to constrain paragraph
further. For example, to check for only captioned standalone
images, set it to:
(lambda (paragraph) (org-element-property :caption paragraph))"
(let ((paragraph (pcase (org-element-type element)
(`paragraph element)
(`link (org-export-get-parent element)))))
(and (eq (org-element-type paragraph) 'paragraph)
(or (not (and (boundp 'org-html-standalone-image-predicate)
(fboundp org-html-standalone-image-predicate)))
(funcall org-html-standalone-image-predicate paragraph))
(catch 'exit
(let ((link-count 0))
(org-element-map (org-element-contents paragraph)
(cons 'plain-text org-element-all-objects)
(lambda (obj)
(when (pcase (org-element-type obj)
(`plain-text (org-string-nw-p obj))
(`link (or (> (cl-incf link-count) 1)
(not (org-html-inline-image-p obj info))))
(_ t))
(throw 'exit nil)))
info nil 'link)
(= link-count 1))))))