forked from mirrors/org-mode
Merge branch 'maint'
This commit is contained in:
commit
a70fff50d0
13
lisp/ox.el
13
lisp/ox.el
|
@ -3461,15 +3461,16 @@ Move point after the link."
|
||||||
(goto-char (org-element-property :end link))
|
(goto-char (org-element-property :end link))
|
||||||
(let ((new-path (file-relative-name (expand-file-name path file-dir)
|
(let ((new-path (file-relative-name (expand-file-name path file-dir)
|
||||||
includer-dir))
|
includer-dir))
|
||||||
(new-link (org-element-copy link))
|
(new-link (org-element-copy link)))
|
||||||
(contents (and (org-element-property :contents-begin link)
|
|
||||||
(buffer-substring
|
|
||||||
(org-element-property :contents-begin link)
|
|
||||||
(org-element-property :contents-end link)))))
|
|
||||||
(org-element-put-property new-link :path new-path)
|
(org-element-put-property new-link :path new-path)
|
||||||
|
(when (org-element-property :contents-begin link)
|
||||||
|
(org-element-adopt-elements new-link
|
||||||
|
(buffer-substring
|
||||||
|
(org-element-property :contents-begin link)
|
||||||
|
(org-element-property :contents-end link))))
|
||||||
(delete-region (org-element-property :begin link)
|
(delete-region (org-element-property :begin link)
|
||||||
(org-element-property :end link))
|
(org-element-property :end link))
|
||||||
(insert (org-element-link-interpreter new-link contents))))))
|
(insert (org-element-interpret-data new-link))))))
|
||||||
|
|
||||||
(defun org-export--prepare-file-contents
|
(defun org-export--prepare-file-contents
|
||||||
(file &optional lines ind minlevel id footnotes includer)
|
(file &optional lines ind minlevel id footnotes includer)
|
||||||
|
|
|
@ -1440,6 +1440,28 @@ Footnotes[fn:2], foot[fn:test] and [fn:inline:inline footnote]
|
||||||
(kill-buffer buffer))
|
(kill-buffer buffer))
|
||||||
(when (file-exists-p subdir) (delete-directory subdir t))
|
(when (file-exists-p subdir) (delete-directory subdir t))
|
||||||
(when (file-exists-p includer) (delete-file includer)))))))
|
(when (file-exists-p includer) (delete-file includer)))))))
|
||||||
|
;; Preserve relative bracket links without description.
|
||||||
|
(should
|
||||||
|
(string-suffix-p
|
||||||
|
"foo.org]] :tag:"
|
||||||
|
(let* ((subdir (make-temp-file "org-includee-" t))
|
||||||
|
(includee (expand-file-name "includee.org" subdir))
|
||||||
|
(includer (make-temp-file "org-includer-")))
|
||||||
|
(write-region "[[file:foo.org]] :tag:" nil includee)
|
||||||
|
(write-region (format "#+INCLUDE: %S"
|
||||||
|
(file-relative-name includee
|
||||||
|
temporary-file-directory))
|
||||||
|
nil includer)
|
||||||
|
(let ((buffer (find-file-noselect includer t)))
|
||||||
|
(unwind-protect
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(org-export-expand-include-keyword)
|
||||||
|
(org-trim (buffer-string)))
|
||||||
|
(when (buffer-live-p buffer)
|
||||||
|
(with-current-buffer buffer (set-buffer-modified-p nil))
|
||||||
|
(kill-buffer buffer))
|
||||||
|
(when (file-exists-p subdir) (delete-directory subdir t))
|
||||||
|
(when (file-exists-p includer) (delete-file includer)))))))
|
||||||
;; Preserve relative bracket links with description.
|
;; Preserve relative bracket links with description.
|
||||||
(should
|
(should
|
||||||
(string-prefix-p
|
(string-prefix-p
|
||||||
|
|
Loading…
Reference in a new issue