diff options
author | Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> | 2018-12-08 16:44:06 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-12-08 21:20:18 +0100 |
commit | 3b5e26651b7e634c7ff3bf593cbb24511086172b (patch) | |
tree | 75dc6be649280f1cb1265591ff1d8f8081b6f538 | |
parent | e9108043e1f9801ef1ee4d86186352b4671ddffa (diff) | |
download | org-mode-3b5e26651b7e634c7ff3bf593cbb24511086172b.tar.gz |
ox-html: Export attributes specified with :attr_html for links
* lisp/ox-html.el (org-html-link): Export :attr_html from link.
-rw-r--r-- | lisp/ox-html.el | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/lisp/ox-html.el b/lisp/ox-html.el index 6a81be1..b4ec257 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 'link (org-element-type container)) + (org-html-inline-image-p link info)) + container + link)))) + (and (eq link (org-element-map parent 'link #'identity info t)) + (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. + (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) "")))) |