Function: org-odt-toc

org-odt-toc is a byte-compiled function defined in ox-odt.el.gz.

Signature

(org-odt-toc DEPTH INFO &optional SCOPE)

Documentation

Build a table of contents.

DEPTH is an integer specifying the depth of the table. INFO is a plist containing current export properties. Optional argument SCOPE, when non-nil, defines the scope of the table. Return the table of contents as a string, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/org/ox-odt.el.gz
(defun org-odt-toc (depth info &optional scope)
  "Build a table of contents.
DEPTH is an integer specifying the depth of the table.  INFO is
a plist containing current export properties.  Optional argument
SCOPE, when non-nil, defines the scope of the table.  Return the
table of contents as a string, or nil."
  (cl-assert (wholenump depth))
  ;; When a headline is marked as a radio target, as in the example below:
  ;;
  ;; ** <<<Some Heading>>>
  ;;    Some text.
  ;;
  ;; suppress generation of radio targets.  i.e., Radio targets are to
  ;; be marked as targets within /document body/ and *not* within
  ;; /TOC/, as otherwise there will be duplicated anchors one in TOC
  ;; and one in the document body.
  ;;
  ;; Likewise, links, footnote references and regular targets are also
  ;; suppressed.
  (let* ((headlines (org-export-collect-headlines info depth scope))
	 (backend (org-export-toc-entry-backend
		      (org-export-backend-name (plist-get info :back-end)))))
    (when headlines
      (org-odt--format-toc
       (and (not scope) (org-export-translate "Table of Contents" :utf-8 info))
       (mapconcat
	(lambda (headline)
	  (let* ((entry (org-odt-format-headline--wrap
			 headline backend info 'org-odt-format-toc-headline))
		 (level (org-export-get-relative-level headline info))
		 (style (format "Contents_20_%d" level)))
	    (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
		    style entry)))
	headlines "\n")
       depth))))