ox: Small refactoring

* lisp/ox.el (org-export-get-category): Refactor code.
This commit is contained in:
Nicolas Goaziou 2014-06-18 23:30:54 +02:00
parent ab145f0df5
commit 8b959237fc
1 changed files with 1 additions and 13 deletions

View File

@ -3875,19 +3875,7 @@ INFO is a plist used as a communication channel.
CATEGORY is automatically inherited from a parent headline, from
#+CATEGORY: keyword or created out of original file name. If all
fail, the fall-back value is \"???\"."
(or (let ((headline (if (eq (org-element-type blob) 'headline) blob
(org-export-get-parent-headline blob))))
;; Almost like `org-export-node-property', but we cannot trust
;; `plist-member' as every headline has a `:CATEGORY'
;; property, would it be nil or equal to "???" (which has the
;; same meaning).
(let ((parent headline) value)
(catch 'found
(while parent
(let ((category (org-element-property :CATEGORY parent)))
(and category (not (equal "???" category))
(throw 'found category)))
(setq parent (org-element-property :parent parent))))))
(or (org-export-get-node-property :CATEGORY blob t)
(org-element-map (plist-get info :parse-tree) 'keyword
(lambda (kwd)
(when (equal (org-element-property :key kwd) "CATEGORY")