Function: POST-PROCESS-NAVIGATION

Source

(defun post-process-navigation (parts)
    ;;;; setup the prev and next links in the header objects
  (iterate
    (with last-heading = nil)
    (for part in parts)
    (when (heading-part-p part)
      (when last-heading
        (setf (prev-part part) last-heading
              (next-part last-heading) part))
      (setf last-heading part)))
  ;;;; setup the up links
  (iterate
    (for (this . rest) on (remove-if-not #'heading-part-p parts))
    (iterate
      (for r in rest)
      (while (< (depth this) (depth r)))
      (setf (up-part r) this)))
  parts)
Source Context