         (let [m (partial ?match line)]
           (cond-let
             [text]
-            (m testcode) text
-
-            (m include)
-            (let [[path comment lang] (include-info text)]
-              (binding [*path* path]
-                (binding [*single-comment* comment]
-                  (binding [*language* lang]
-                    (write-test-file path outdir)))))
-
-            (m required)
-            (io/copy text (io/file outdir text))
-
-            :else line))))))
-
-(defn write-test-tree
+            (m test-begin)
+            (do (reset! in-test? true)
+              line)
+
+            (m test-end)
+            (do (reset! in-test? false)
+              line)
+
+            :else
+            (if @in-test?
+              (str *single-comment* line)
+              (cond-let
+                [text]
+                (m include)
+                (let [[path comment lang] (include-info text)]
+                  (binding [*path* path]
+                    (binding [*single-comment* comment]
+                      (binding [*language* lang]
+                        (write-production-file path outdir))))
+                  line)
+
+                (m required)
+                (do (io/copy text (io/file outdir text))
+                  line)
+
+                :else line))))))))
+
+(defn write-production-tree
   ""
   [in-paths outdir]
   (when (fs/exists? outdir)
     (fs/deltree outdir))
   (fs/mkdir outdir)
   (doseq [p in-paths]
-    (write-test-file p outdir)))
+    (write-production-file p outdir)))
 
 
 ; ## Commandline

  []
  (re-pattern (str (comment) "%require +")))

(defn testcode
  "A regular expression matching the beginning of a test comment."
  []
  (re-pattern (str (comment) "\\? ")))


; ## Parsing

      [text]
      (m include) [[:include (include-info text)]]
      (m required) []
      (m test-begin) [[:test-begin text]]
      (m test-end) [[:test-end text]]
      (m anchor) [[:anchor text]]
      (m heading) [[:anchor text]
                   [:comment (m markdown)]]
