summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2014-05-15 13:45:38 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2014-05-15 13:45:38 +0200
commit6cdf1b6d3f1d04ab22e71500275a0853577976cc (patch)
tree25800a69c30f7daf241897227de5be7e18d03da8
parent7893cddc883eb6fd0f6d9050a4d29078898deb57 (diff)
parentab1ce2a757000f7d8a66de023051c13ddc9705ec (diff)
downloadorg-mode-6cdf1b6d3f1d04ab22e71500275a0853577976cc.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/ox-html.el39
1 files changed, 20 insertions, 19 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 0846de5..0be45b7 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2661,18 +2661,17 @@ if its description is a single link targeting an image file."
(defvar org-html-standalone-image-predicate)
(defun org-html-standalone-image-p (element info)
- "Test if ELEMENT is a standalone image.
+ "Non-nil if ELEMENT is a standalone image.
INFO is a plist holding contextual information.
-Return non-nil, if ELEMENT is of type paragraph and its sole
-content, save for white spaces, is a link that qualifies as an
-inline image.
+An element or object is a standalone image when
-Return non-nil, if ELEMENT is of type link and its containing
-paragraph has no other content save white spaces.
+ - its type is `paragraph' and its sole content, save for white
+ spaces, is a link that qualifies as an inline image;
-Return nil, otherwise.
+ - 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
@@ -2683,19 +2682,21 @@ images, set it to:
(paragraph element)
(link (org-export-get-parent element)))))
(and (eq (org-element-type paragraph) 'paragraph)
- (or (not (and (boundp 'org-html-standalone-image-predicate)
- (functionp org-html-standalone-image-predicate)))
+ (or (not (fboundp 'org-html-standalone-image-predicate))
(funcall org-html-standalone-image-predicate paragraph))
- (not (let ((link-count 0))
- (org-element-map (org-element-contents paragraph)
- (cons 'plain-text org-element-all-objects)
- (lambda (obj) (case (org-element-type obj)
- (plain-text (org-string-nw-p obj))
- (link
- (or (> (incf link-count) 1)
- (not (org-html-inline-image-p obj info))))
- (otherwise t)))
- info 'first-match 'link))))))
+ (catch 'exit
+ (let ((link-count 0))
+ (org-element-map (org-element-contents paragraph)
+ (cons 'plain-text org-element-all-objects)
+ #'(lambda (obj)
+ (when (case (org-element-type obj)
+ (plain-text (org-string-nw-p obj))
+ (link (or (> (incf link-count) 1)
+ (not (org-html-inline-image-p obj info))))
+ (otherwise t))
+ (throw 'exit nil)))
+ info nil 'link)
+ (= link-count 1))))))
(defun org-html-link (link desc info)
"Transcode a LINK object from Org to HTML.