From 3ac50ac3a3c8951d59a1d30b047ae0407731b789 Mon Sep 17 00:00:00 2001 From: Jens Lechtenboerger Date: Sat, 8 Dec 2018 16:44:06 +0100 Subject: [PATCH] ox-html.el: Export attributes specified with :attr_html for links * lisp/ox-html.el (org-html-link): Export :attr_html from link --- lisp/ox-html.el | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 6a81be126..bbe38d8e2 100644 --- a/lisp/ox-html.el +++ b/lisp/ox-html.el @@ -3045,19 +3045,25 @@ INFO is a plist holding contextual information. See "#" (org-publish-resolve-external-link option path t)))))) (t raw-path))) - ;; 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)) - (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)))) + (org-combine-plists + ;; 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. + (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))) + ;; Also add attributes from link itself. Currently, those need + ;; to be added programmatically before org-html-link is invoked, + ;; for example, by backends building upon HTML export, such as + ;; org-reveal. + (org-export-read-attribute :attr_html link))) (attributes (let ((attr (org-html--make-attribute-string attributes-plist))) (if (org-string-nw-p attr) (concat " " attr) "")))) -- 2.17.1