org-export: Objects in secondary strings can also be ignored

* contrib/lisp/org-export.el (org-export--populate-ignore-list): Move
  into secondary strings when looking for objects to ignore in the
  parse tree.
This commit is contained in:
Nicolas Goaziou 2012-08-27 14:41:33 +02:00
parent 86b1be57b9
commit 9f2824852c
1 changed files with 23 additions and 22 deletions

View File

@ -1733,29 +1733,30 @@ associated numbering \(in the shape of a list of numbers\)."
DATA is the parse tree to traverse. OPTIONS is the plist holding DATA is the parse tree to traverse. OPTIONS is the plist holding
export options." export options."
(let* (ignore (let* (ignore
walk-data ; for byte-compiler. walk-data
;; First find trees containing a select tag, if any.
(selected (org-export--selected-trees data options))
(walk-data (walk-data
(function (lambda (data)
(lambda (data options selected)
;; Collect ignored elements or objects into IGNORE-LIST. ;; Collect ignored elements or objects into IGNORE-LIST.
(mapc (let ((type (org-element-type data)))
(lambda (el) (if (org-export--skip-p data options selected) (push data ignore)
(if (org-export--skip-p el options selected) (push el ignore) (if (and (eq type 'headline)
(let ((type (org-element-type el))) (eq (plist-get options :with-archived-trees) 'headline)
(if (and (eq (plist-get options :with-archived-trees) (org-element-property :archivedp data))
'headline)
(eq (org-element-type el) 'headline)
(org-element-property :archivedp el))
;; If headline is archived but tree below has ;; If headline is archived but tree below has
;; to be skipped, add it to ignore list. ;; to be skipped, add it to ignore list.
(mapc (lambda (e) (push e ignore)) (mapc (lambda (e) (push e ignore))
(org-element-contents el)) (org-element-contents data))
;; Move into secondary string, if any.
(let ((sec-prop
(cdr (assq type org-element-secondary-value-alist))))
(when sec-prop
(mapc walk-data (org-element-property sec-prop data))))
;; Move into recursive objects/elements. ;; Move into recursive objects/elements.
(when (org-element-contents el) (mapc walk-data (org-element-contents data))))))))
(funcall walk-data el options selected)))))) ;; Main call.
(org-element-contents data)))))) (funcall walk-data data)
;; Main call. First find trees containing a select tag, if any.
(funcall walk-data data options (org-export--selected-trees data options))
;; Return value. ;; Return value.
ignore)) ignore))