From 59a829b9ef8e0e8f47a2417228fb49b6ab500eff Mon Sep 17 00:00:00 2001 From: gered Date: Sun, 6 Apr 2014 09:34:02 -0400 Subject: [PATCH] little bit of cleanup --- src/toascii/models/image.clj | 40 ++++++++---------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/src/toascii/models/image.clj b/src/toascii/models/image.clj index 35d9385..3557ade 100644 --- a/src/toascii/models/image.clj +++ b/src/toascii/models/image.clj @@ -1,13 +1,11 @@ (ns toascii.models.image (:import (java.awt.image BufferedImage) - (java.io Writer) - (javax.imageio.stream ImageInputStream)) - (:require [clojure.string :as str] - [clojure.java.io :as io] + (javax.imageio.stream ImageInputStream) + (java.io Writer)) + (:require [clojure.java.io :as io] [ring.util.io :refer [piped-input-stream]] [clj-image2ascii.core :as i2a] - [toascii.util :refer [query-param-url->java-url]]) - (:use hiccup.core)) + [toascii.util :refer [query-param-url->java-url]])) (def js-gif-animation (slurp (io/resource "gif-animation.js"))) @@ -21,33 +19,11 @@ (let [java-url (query-param-url->java-url url)] (i2a/get-image-stream-by-url java-url))) -(defn- wrap-pre-tag [s & {:keys [hidden? delay]}] - (str - "
" s "
")) - -(defn- get-open-pre-tag [hidden? delay] - (str - "
"))
-
 (defn image->ascii [^BufferedImage image scale-to-width color? html?]
   (let [converted (i2a/convert-image image scale-to-width color?)
         ascii     (:image converted)]
     (if html?
-      (wrap-pre-tag ascii)
+      (str "
" ascii "
") ascii))) (defn- write-out [^Writer w s] @@ -61,9 +37,9 @@ (i2a/stream-animated-gif-frames! image-stream scale-to-width color? (fn [{:keys [image delay]}] - (write-out w (get-open-pre-tag true delay)) - (write-out w image) - (write-out w "
"))) + (write-out w (str "
"))
+            (write-out w image)
+            (write-out w "
"))) (write-out w "") (write-out w "