<?xml version="1.0"?>
<paste-with-annotations>
  <paste>
    <number>
      <integer>4744</integer>
    </number>
    <user>
      <string>luis</string>
    </user>
    <title>
      <string>Colorize example</string>
    </title>
    <contents>
      <string>;; (require :cl-ppcre)
;; (require :colorize)

#| This little example opens a file, and looks for
   &lt;!-- LISP foobar --&gt; tokens which it then substitutes
   with the colorized code of the &quot;foobar&quot; file. |#

;; this regex needs some tweaking
(defparameter *rgx* &quot;(.*)&lt;!-- LISP +(\\S+) +--&gt;(.*)&quot;)

(defun lisp-into-html (file-in file-out)
  (with-open-file (html file-in :direction :input)
    (with-open-file (out file-out :direction :output :if-exists :error)
      (loop with line
            while (setq line (read-line html nil nil))
            do (multiple-value-bind (found-p res)
                   (cl-ppcre:scan-to-strings *rgx* line)
                 (if found-p
                     (progn
                       (write-string (aref res 0) out)
                       (write-string &quot;&lt;div class=\&quot;code\&quot;&gt;&quot; out)
                       (colorize:colorize-file-to-stream :common-lisp
                                                         (aref res 1) ; input file
                                                         out
                                                         :wrap nil)
                       (write-string &quot;&lt;/div&gt;&quot; out)
                       (write-string (aref res 2) out)
                       (terpri))
                     (write-line line out)))))))</string>
    </contents>
    <universal-time>
      <integer>3313875611</integer>
    </universal-time>
    <channel>
      <string>None</string>
    </channel>
    <colorization-mode>
      <string>Common Lisp</string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <null/>
    </is-unicode>
  </paste>
  <annotation>
    <number>
      <integer>2</integer>
    </number>
    <user>
      <string>A</string>
    </user>
    <title>
      <string>S</string>
    </title>
    <contents>
      <string>ASDF ASDF ASDF</string>
    </contents>
    <universal-time>
      <integer>3357011232</integer>
    </universal-time>
    <channel>
      <string>None</string>
    </channel>
    <colorization-mode>
      <string></string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <null/>
    </is-unicode>
  </annotation>
  <annotation>
    <number>
      <integer>1</integer>
    </number>
    <user>
      <string>verec</string>
    </user>
    <title>
      <string>test-ppmx</string>
    </title>
    <contents>
      <string>;; ppmx: pretty print macro expansion

(defmacro ppmx (form)
  &quot;Pretty prints the macro expansion of FORM.&quot;
  `(let* ((exp1 (macroexpand-1 ',form))
          (exp (macroexpand exp1))
          (*print-circle* nil))
     (cond ((equal exp exp1)
            (format t &quot;~&amp;Macro expansion:&quot;)
            (pprint exp))
           (t (format t &quot;~&amp;First step of expansion:&quot;)
              (pprint exp1)
              (format t &quot;~%~%Final expansion:&quot;)
              (pprint exp)))
     (format t &quot;~%~%&quot;)
     (values)))
</string>
    </contents>
    <universal-time>
      <integer>3342028320</integer>
    </universal-time>
    <channel>
      <string>None</string>
    </channel>
    <colorization-mode>
      <string></string>
    </colorization-mode>
    <maybe-spam>
      <null/>
    </maybe-spam>
    <is-unicode>
      <null/>
    </is-unicode>
  </annotation>
</paste-with-annotations>