org-export: Small refactoring

* contrib/lisp/org-export.el (org-export--get-buffer-attributes):
  Small refactoring.
This commit is contained in:
Nicolas Goaziou 2012-09-30 13:59:05 +02:00
parent 9f7fd9d2bb
commit e189be5720

View file

@ -1516,30 +1516,29 @@ Assume buffer is in Org mode. Narrowing, if any, is ignored."
(org-with-wide-buffer (org-with-wide-buffer
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward org-footnote-definition-re nil t) (while (re-search-forward org-footnote-definition-re nil t)
(let ((def (org-footnote-at-definition-p))) (let ((def (save-match-data (org-element-at-point))))
(when def (when (eq (org-element-type def) 'footnote-definition)
(org-skip-whitespace) (push
(push (cons (car def) (cons (org-element-property :label def)
(save-restriction (let ((cbeg (org-element-property :contents-begin def)))
(narrow-to-region (point) (nth 2 def)) (when cbeg
;; Like `org-element-parse-buffer', but (org-element--parse-elements
;; makes sure the definition doesn't start cbeg (org-element-property :contents-end def)
;; with a section element. nil nil nil nil (list 'org-data nil)))))
(org-element--parse-elements alist))))
(point-min) (point-max) nil nil nil nil
(list 'org-data nil))))
alist))))
alist)) alist))
:id-alist :id-alist
;; Collect id references. ;; Collect id references.
(let (alist) (let (alist)
(org-with-wide-buffer (org-with-wide-buffer
(goto-char (point-min)) (goto-char (point-min))
(while (re-search-forward (while (re-search-forward "\\[\\[id:\\S-+?\\]" nil t)
"\\[\\[id:\\(\\S-+?\\)\\]\\(?:\\[.*?\\]\\)?\\]" nil t) (let ((link (org-element-context)))
(let* ((id (org-match-string-no-properties 1)) (when (eq (org-element-type link) 'link)
(file (org-id-find-id-file id))) (let* ((id (org-element-property :path link))
(when file (push (cons id (file-relative-name file)) alist))))) (file (org-id-find-id-file id)))
(when file
(push (cons id (file-relative-name file)) alist)))))))
alist)))) alist))))
(defun org-export--get-global-options (&optional backend) (defun org-export--get-global-options (&optional backend)