diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-01-07 15:48:49 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2017-01-07 15:48:49 +0100 |
commit | d809a604f26b28d1b425239e8789445698836f3a (patch) | |
tree | 4f6e541debd7215e28321366d098030449611748 | |
parent | 22520e8087aa6c27be2f4f06ddae04b7bbfa81c9 (diff) | |
download | org-mode-d809a604f26b28d1b425239e8789445698836f3a.tar.gz |
ox: Fix image links
* lisp/ox.el (org-export-insert-image-links): Properly set :parent
property.
* testing/lisp/test-ox.el (test-org-export/insert-image-links): Add
test.
Reported-by: Kaushal Modi <kaushal.modi@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/111238>
-rw-r--r-- | lisp/ox.el | 5 | ||||
-rw-r--r-- | testing/lisp/test-ox.el | 8 |
2 files changed, 11 insertions, 2 deletions
@@ -4227,8 +4227,9 @@ Return modified DATA." (and (string= type (car rule)) (string-match-p (cdr rule) path))) (or rules org-export-default-inline-image-rule)) - (org-element-set-contents - l + ;; Replace contents with image link. + (org-element-adopt-elements + (org-element-set-contents l nil) (with-temp-buffer (save-excursion (insert contents)) (org-element-link-parser)))))))) diff --git a/testing/lisp/test-ox.el b/testing/lisp/test-ox.el index 9f4a8e5..ab1e536 100644 --- a/testing/lisp/test-ox.el +++ b/testing/lisp/test-ox.el @@ -2757,6 +2757,14 @@ Para2" (org-test-with-parsed-data "[[http://orgmode.org][file:image.png]]" (org-element-map (org-export-insert-image-links tree info) 'link (lambda (l) (org-element-property :type l)))))) + ;; Properly set `:parent' property when replace contents with image + ;; link. + (should + (memq 'link + (org-test-with-parsed-data "[[http://orgmode.org][file:image.png]]" + (org-element-map (org-export-insert-image-links tree info) 'link + (lambda (l) + (org-element-type (org-element-property :parent l))))))) ;; With optional argument RULES, recognize different links as ;; images. (should-not |