ox: Check id links in export scope only
* lisp/ox.el (org-export-get-environment): Do not fill :id-alist yet. (org-export-collect-tree-properties): Complete it here instead. Reported-by: Samuel Wales <samologist@gmail.com> <http://permalink.gmane.org/gmane.emacs.orgmode/102540>
This commit is contained in:
parent
0611129578
commit
f329279757
44
lisp/ox.el
44
lisp/ox.el
|
@ -1338,23 +1338,8 @@ inferior to file-local settings."
|
||||||
;; ... and from subtree, when appropriate.
|
;; ... and from subtree, when appropriate.
|
||||||
(and subtreep (org-export--get-subtree-options backend))
|
(and subtreep (org-export--get-subtree-options backend))
|
||||||
;; Eventually add misc. properties.
|
;; Eventually add misc. properties.
|
||||||
(list
|
(list :back-end backend
|
||||||
:back-end
|
:translate-alist (org-export-get-all-transcoders backend))))
|
||||||
backend
|
|
||||||
:translate-alist (org-export-get-all-transcoders backend)
|
|
||||||
:id-alist
|
|
||||||
;; Collect id references.
|
|
||||||
(let (alist)
|
|
||||||
(org-with-wide-buffer
|
|
||||||
(goto-char (point-min))
|
|
||||||
(while (re-search-forward "\\[\\[id:\\S-+?\\]" nil t)
|
|
||||||
(let ((link (org-element-context)))
|
|
||||||
(when (eq (org-element-type link) 'link)
|
|
||||||
(let* ((id (org-element-property :path link))
|
|
||||||
(file (car (org-id-find id))))
|
|
||||||
(when file
|
|
||||||
(push (cons id (file-relative-name file)) alist)))))))
|
|
||||||
alist))))
|
|
||||||
|
|
||||||
(defun org-export--parse-option-keyword (options &optional backend)
|
(defun org-export--parse-option-keyword (options &optional backend)
|
||||||
"Parse an OPTIONS line and return values as a plist.
|
"Parse an OPTIONS line and return values as a plist.
|
||||||
|
@ -1659,9 +1644,12 @@ Following tree properties are set or updated:
|
||||||
of level 2 should be considered as a level
|
of level 2 should be considered as a level
|
||||||
1 headline in the context.
|
1 headline in the context.
|
||||||
|
|
||||||
`:headline-numbering' Alist of all headlines as key an the
|
`:headline-numbering' Alist of all headlines as key and the
|
||||||
associated numbering as value.
|
associated numbering as value.
|
||||||
|
|
||||||
|
`:id-alist' Alist of all ID references as key and associated file
|
||||||
|
as value.
|
||||||
|
|
||||||
Return updated plist."
|
Return updated plist."
|
||||||
;; Install the parse tree in the communication channel.
|
;; Install the parse tree in the communication channel.
|
||||||
(setq info (plist-put info :parse-tree data))
|
(setq info (plist-put info :parse-tree data))
|
||||||
|
@ -1673,10 +1661,22 @@ Return updated plist."
|
||||||
(- 1 (org-export--get-min-level data info))))
|
(- 1 (org-export--get-min-level data info))))
|
||||||
;; Properties order doesn't matter: get the rest of the tree
|
;; Properties order doesn't matter: get the rest of the tree
|
||||||
;; properties.
|
;; properties.
|
||||||
(nconc
|
(setq info
|
||||||
`(:headline-numbering ,(org-export--collect-headline-numbering data info)
|
(plist-put info
|
||||||
:exported-data ,(make-hash-table :test 'eq :size 4001))
|
:headline-numbering
|
||||||
info))
|
(org-export--collect-headline-numbering data info)))
|
||||||
|
(setq info
|
||||||
|
(plist-put info
|
||||||
|
:exported-data (make-hash-table :test #'eq :size 4001)))
|
||||||
|
(plist-put info
|
||||||
|
:id-alist
|
||||||
|
;; Collect id references.
|
||||||
|
(org-element-map data 'link
|
||||||
|
(lambda (l)
|
||||||
|
(and (string= (org-element-property :type l) "id")
|
||||||
|
(let* ((id (org-element-property :path l))
|
||||||
|
(file (car (org-id-find id))))
|
||||||
|
(and file (cons id (file-relative-name file)))))))))
|
||||||
|
|
||||||
(defun org-export--get-min-level (data options)
|
(defun org-export--get-min-level (data options)
|
||||||
"Return minimum exportable headline's level in DATA.
|
"Return minimum exportable headline's level in DATA.
|
||||||
|
|
Loading…
Reference in New Issue