From f60773e3b3762a3a11143c2215441147f555ec4e Mon Sep 17 00:00:00 2001 From: Masanao Igarashi Date: Tue, 13 Aug 2019 11:01:36 +0900 Subject: [PATCH] Export attributes specified with :attr_rst for links (3b5e2665) --- ox-rst.el | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/ox-rst.el b/ox-rst.el index d8aa650..6da440e 100644 --- a/ox-rst.el +++ b/ox-rst.el @@ -964,19 +964,25 @@ INFO is a plist holding contextual information." (concat (file-name-as-directory home) raw-path))) (t raw-path))) (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-rst-inline-image-p link info)) - container - link)))) - (and (eq (org-element-map parent 'link 'identity info t) link) - (org-export-read-attribute :attr_rst 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_ 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_rst link))) (attributes (let ((attr (org-rst--make-attribute-string attributes-plist))) (if (org-string-nw-p attr) (concat "\n" attr "\n") ""))))