summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-07-10 10:12:43 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2013-07-10 10:12:43 +0200
commit020eb8eaef35a26641d7c3840229856a7ec27281 (patch)
treedade365a5e5cdfcd252b09ce7e6e1b141a4e87a6
parent535bf4a1f25ffa280741e0eefc5a3b4308056f11 (diff)
downloadorg-mode-020eb8eaef35a26641d7c3840229856a7ec27281.tar.gz
ox-html: Fix inline image attributes
* lisp/ox-html.el (org-html-link): Add image attributes to "img" tag, not to the "a" container. Also fix spacing for attributes. Thanks to Robert Eckl for reporting it.
-rw-r--r--lisp/ox-html.el18
1 files changed, 13 insertions, 5 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el
index 4208845..9843d98 100644
--- a/lisp/ox-html.el
+++ b/lisp/ox-html.el
@@ -2651,14 +2651,22 @@ INFO is a plist holding contextual information. See
numbers "-"))))))
(t raw-path))))
(t raw-path)))
- ;; Extract attributes from parent's paragraph. HACK: Only do
- ;; this for the first link in parent. This is needed as long
- ;; as attributes cannot be set on a per link basis.
+ ;; Extract attributes from parent's paragraph. HACK: Only 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.
(attributes-plist
- (let ((parent (org-export-get-parent-element link)))
+ (let* ((parent (org-export-get-parent-element link))
+ (link (let ((container (org-export-get-parent link)))
+ (if (and (eq (org-element-type container) 'link)
+ (org-html-inline-image-p link info))
+ container
+ link))))
(and (eq (org-element-map parent 'link 'identity info t) link)
(org-export-read-attribute :attr_html parent))))
- (attributes (org-html--make-attribute-string attributes-plist))
+ (attributes
+ (let ((attr (org-html--make-attribute-string attributes-plist)))
+ (if (org-string-nw-p attr) (concat " " attr) "")))
protocol)
(cond
;; Image file.