anchor.diff:                   :base-stream base-stream))
   
   (serapeum:defmethods html-stream (s col line last-char base-stream)
  +  (:method stream-line-column (s)
  +    col)
  +
  +  (:method stream-start-line-p (s)
  +    (= col 0))
  +
     (:method stream-write-char (s char)
  +    (when (eql last-char elastic-newline)
  +      (unless (eql char #\Newline)
  +        (write-char #\Newline base-stream)
  +        (incf line)
  +        (setf col 0)))
       (when (eql char #\Newline)
         (incf line)
         (setf col 0))
  +    (write-char char base-stream)
       (setf last-char char)
  -    (write-char char base-stream)
       char)
  -  (:method stream-line-column (s)
  -    col)
  -  (:method stream-start-line-p (s)
  -    (= col 0))
  +
     (:method stream-write-string (s string &optional (start 0) end)
       (let ((end (or end (length string)))
             (start (or start 0)))
  
positive.code:                       end)))
            (write-string string base-stream :start start :end nl)
            (when (> (- nl start) 0)
              (setf last-char (aref string (1- nl))))
            (incf col (- nl start))
            (unless (= nl end)
              (incf line)
              (setf col 0)
              (rec (1+ nl))))))
      string)
    (:method stream-terpri (s)
      (incf line)
      (setf col 0)
      (setf last-char #\Newline)
      (terpri base-stream))
    (:method stream-fresh-line (s)
      (unless (eql last-char #\Newline)
        (terpri s)))
    (:method stream-finish-output (s)
      (finish-output base-stream))
    (:method stream-force-output (s)
      (force-output base-stream))
    (:method stream-advance-to-column (s c)
      (when (< col c)
        (loop repeat (- c col) do
          (write-char #\Space s)))
      t))
  
negative.code: (in-package :spinneret)
  
  (progn
    (deftype elastic-newline ()
      '(eql #1=:elastic-newline))
    (serapeum:defconst elastic-newline #1#))
  
  (defclass html-stream (fundamental-character-input-stream)
    ((col :type (integer 0 *) :initform 0)
     (line :type (integer 0 *) :initform 0)
     (last-char :type (or character elastic-newline)
                ;; The last char defaults to newline to get reasonable
                ;; behavior from fresh-line.
                :initform #\Newline
                :accessor .last-char)
     (base-stream :type stream
                  :initarg :base-stream)))
  
  