                     (= :html k) v
                     (= :date k) (date/format-long-date v)
                     (= :court k) (courts/*court-names* v)
-                    (= :name k) (if (or (nil? v) (empty? v))
+                    (= :name k) (if (empty? v)
                                   (str "Untitled #" (:docid doc))
                                   (tmpl/h v))
                     (#{:citations :dockets} k) (map tmpl/h v)

;;; TEXT PAGES

(defmethod gen-case-layout :text [type doc]
  (tmpl/render :default_layout
               :page_class (str "doctype_" (:doctype doc))
               :content_head (tmpl/render :case_head_layout doc)
               :content_body (:html doc)
               :sidebar (tmpl/render :case_sidebar
                                     :doclinks (doclinks doc))))


;;; CITATION PAGES

  

(defmethod gen-case-layout :citations [type doc]
  (tmpl/render "case/citations_page"
               doc
               :incites (prepare-citelinks (:incites doc))
               :outcites (prepare-citelinks (:outcites doc))
               :doclinks (doclinks doc)))


;;; GENERATE ALL PAGES

(defn gen-case-page [type doc]
  (let [escaped (escape-fields doc)]
    (gen-case-layout type escaped)))

(defn all-files [doc]
  (reduce (fn [m type]
