Function: WRITE-COMMENT

Source

(defun write-comment (part state)
  (etypecase part
    (heading-part
     (ecase state
       ((nil))
       (:in-comment
        ;; heading during a comment, break the current comment
        ;; and start a new one.
        (write-string "</p>" *yaclml-stream*)
        (terpri *yaclml-stream*)))
     (flet ((heading ()
              (<:a :name (make-anchor-name (text part)) (<:as-html (text part)))
              (<:as-is "&nbsp;"))
            (nav-links ()
              (<:div :class "nav-links"
                     (if (prev-part part)
                         (<:a :class "nav-link" :href (make-anchor-link (prev-part part)) "prev")
                         (<:span :class "dead-nav-link" "prev"))
                     " | "
                     (if (up-part part)
                         (<:a :class "nav-link" :href (make-anchor-link (up-part part)) "up")
                         (<:span :class "dead-nav-link" "up"))
                     " | "
                     (if (next-part part)
                         (<:a :href (make-anchor-link (next-part part)) "next")
                         (<:span :class "nav-link" "next"))
                     " | "
                     (<:a :href "index.html" "toc"))))
       (case (depth part)
         (1 (<:h2 (heading)))
         (2 (<:h3 (heading)))
         (3 (<:h4 (heading)))
         (4 (<:h5 (heading)))
         (5 (<:h6 (heading)))
         (t (error "Nesting too deep: ~S." (text part))))
       (nav-links))
     nil)
    (comment-part
        ;;;; regular comment
     (ecase state
       ((nil) (write-string "<p>" *yaclml-stream*))
       (:in-comment nil))
     (if (escape-comments *generator*)
         (<:as-html (text part))
         (<:as-is (text part)))
     :in-comment)))
Source Context