Browse Source

org-html.el (org-html-handle-links): Fix bug in setting the attribute for link with images

* org-html.el (org-html-handle-links): When the link
description is an image and the attribute is "width",
pass the attribute to the <img ...> tag.

Thanks to John Hendy for reporting this.
Bastien Guerry 5 years ago
parent
commit
55f4f92183
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lisp/org-html.el

+ 4 - 1
lisp/org-html.el

@@ -1030,7 +1030,10 @@ OPT-PLIST is the export options list."
 	  (if (string-match "^file:" desc)
 	      (setq desc (substring desc (match-end 0)))))
 	(setq desc (org-add-props
-		       (concat "<img src=\"" desc "\" alt=\""
+		       (concat "<img src=\"" desc "\" "
+			       (when (save-match-data (string-match "width=" attr))
+				 (prog1 (concat attr " ") (setq attr "")))
+			       "alt=\""
 			       (file-name-nondirectory desc) "\"/>")
 		       '(org-protected t))))
       (cond