Function: CONVERT-TO-SECTIONS

Source

(defun convert-to-sections (file-name parts)
  (let ((sections '()))
    (iterate
      (for p in parts)
      (if (and (heading-part-p p)
               (= 1 (depth p)))
          (push (list p) sections)
          (if (consp sections)
              (push p (car sections))
              (error "No initial heading in ~S." file-name))))
    (iterate
      (for section on sections)
      (setf (car section) (nreverse (car section))))
    (nreverse sections)))
Source Context