summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2012-08-24 09:33:58 +0200
committerNicolas Goaziou <n.goaziou@gmail.com>2012-08-24 09:36:18 +0200
commit3f40057adc81999ac7aa994434b5ed1e5e67e4a9 (patch)
tree6fba3523e2e6a0ffda55108a2939e31bb4e2994b
parent5b19471358588746f137635a8ce0c86afb397e31 (diff)
downloadorg-mode-3f40057adc81999ac7aa994434b5ed1e5e67e4a9.tar.gz
org-export: Limit depth of headline collection to headline level
* contrib/lisp/org-export.el (org-export-collect-headlines): By default, limit depth of headline collection to last headline level. * contrib/lisp/org-e-html.el (org-e-html-toc): Small refactoring.
-rw-r--r--contrib/lisp/org-e-html.el3
-rw-r--r--contrib/lisp/org-export.el9
2 files changed, 7 insertions, 5 deletions
diff --git a/contrib/lisp/org-e-html.el b/contrib/lisp/org-e-html.el
index 5754259..94f42ea 100644
--- a/contrib/lisp/org-e-html.el
+++ b/contrib/lisp/org-e-html.el
@@ -1123,8 +1123,7 @@ that uses these same face definitions."
(format "<span class=\"%s\">%s</span>" todo-type headline)))))
(defun org-e-html-toc (depth info)
- (let* ((headlines (org-export-collect-headlines
- info (and (wholenump depth) depth)))
+ (let* ((headlines (org-export-collect-headlines info depth))
(toc-entries
(loop for headline in headlines collect
(list (org-e-html-format-headline--wrap
diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el
index 665c54f..67ec9ac 100644
--- a/contrib/lisp/org-export.el
+++ b/contrib/lisp/org-export.el
@@ -4075,17 +4075,20 @@ return nil."
INFO is a plist used as a communication channel.
-When non-nil, optional argument N must be an integer. It
-specifies the depth of the table of contents.
+When optional argument N is an integer, it specifies the depth of
+the table of contents. Otherwise, it is set to the value of the
+last headline level. See `org-export-headline-levels' for more
+information.
Return a list of all exportable headlines as parsed elements."
+ (unless (wholenump n) (setq n (plist-get info :headline-levels)))
(org-element-map
(plist-get info :parse-tree)
'headline
(lambda (headline)
;; Strip contents from HEADLINE.
(let ((relative-level (org-export-get-relative-level headline info)))
- (unless (and n (> relative-level n)) headline)))
+ (unless (> relative-level n) headline)))
info))
(defun org-export-collect-elements (type info &optional predicate)