Browse Source

ox-html.el (org-html-link): Don't insert nil if there is no attributes

* ox-html.el (org-html-link--inline-image): Small refactoring.
(org-html-link): Don't insert nil if there is no attributes.

Thanks to Samuel Wales for reporting this.
Bastien Guerry 5 years ago
parent
commit
73fe0ab77a
1 changed files with 6 additions and 5 deletions
  1. 6 5
      lisp/ox-html.el

+ 6 - 5
lisp/ox-html.el

@@ -2426,10 +2426,11 @@ Inline images can have these attributes:
 	 (parent (org-export-get-parent-element link))
 	 (caption (org-export-data (org-export-get-caption parent) info))
 	 (label (org-element-property :name parent))
-	 (alt (org-export-read-attribute :attr_html parent :alt))
-	 (width (org-export-read-attribute :attr_html parent :width))
-	 (height (org-export-read-attribute :attr_html parent :height))
-	 (options (org-export-read-attribute :attr_html parent :options)))
+	 (attrs (org-export-read-attribute :attr_html parent))
+	 (alt (plist-get attrs :alt))
+	 (width (plist-get attrs :width))
+	 (height (plist-get attrs :height))
+	 (options (plist-get attrs :options)))
     ;; Return proper string, depending on DISPOSITION.
     (org-html-format-inline-image
      path caption label
@@ -2549,7 +2550,7 @@ INFO is a plist holding contextual information.  See
 		     ""
 		    (let ((att (org-export-read-attribute :attr_html parent :options)))
 		      (unless (and desc att (string-match (regexp-quote att) desc))
-			att)))))
+			(or att ""))))))
 	 (unless (string= attributes "")
 	   (setq attributes (concat " " attributes))))
     (cond