Function: rst-toc-insert-children

rst-toc-insert-children is a byte-compiled function defined in rst.el.gz.

Signature

(rst-toc-insert-children CHILDREN BUF STYLE DEPTH INDENT NUMBERING KEYMAP TGT-STN)

Documentation

In the current buffer at point insert CHILDREN in BUF to table of contents.

See rst-toc-insert-tree for STYLE, DEPTH and TGT-STN. See rst-toc-insert-stn for INDENT and NUMBERING. See rst-toc-insert-link for KEYMAP.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/rst.el.gz
(defun rst-toc-insert-children (children buf style depth indent numbering
					 keymap tgt-stn)
  ;; testcover: ok.
  "In the current buffer at point insert CHILDREN in BUF to table of contents.
See `rst-toc-insert-tree' for STYLE, DEPTH and TGT-STN.  See
`rst-toc-insert-stn' for INDENT and NUMBERING.  See
`rst-toc-insert-link' for KEYMAP."
  (let ((count 1)
	;; Child numbering is done from the parent.
	(num-fmt (format "%%%dd"
			 (1+ (floor (log (1+ (length children)) 10)))))
	fnd)
    (when (not (equal numbering ""))
      ;; Add separating dot to existing numbering.
      (setq numbering (concat numbering ".")))
    (dolist (child children fnd)
      (setq fnd
	    (or (rst-toc-insert-stn child buf style depth indent
				    (concat numbering (format num-fmt count))
				    keymap tgt-stn) fnd))
      (incf count))))