Skip to content

Commit

Permalink
Update for Clojure 1.3-alpha4
Browse files Browse the repository at this point in the history
  • Loading branch information
Chouser committed Jan 26, 2011
1 parent 768e60c commit 785dc4b
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions irc-log-to-html.clj
@@ -1,6 +1,6 @@
(ns irc-log
(:use (clojure.contrib [string :as str :only ()]
[shell :only (sh)]))
(:use [clojure.string :as str :only []]
[clojure.java.shell :only [sh]])
(:import (java.util Date)
(java.text SimpleDateFormat)
(java.nio ByteBuffer)
Expand Down Expand Up @@ -36,17 +36,12 @@

(defn text-to-html [text]
(let [escaped (apply str (map #(or (escape-map %) %) text))
linked (apply str
(for [[text url]
(partition 2 (lazy-cat
(str/partition link-re escaped)
[nil]))]
(str text
(when url
(let [urltext (reduce #(str %1 "<wbr />" %2)
(re-seq wrap-re url))]
(xhtml [:a {:href url :class "nm"}
urltext]))))))]
linked (str/replace escaped link-re
(fn [url]
(let [urltext (reduce #(str %1 "<wbr />" %2)
(re-seq wrap-re url))]
(xhtml [:a {:href url :class "nm"}
urltext]))))]
(str linked "\n")))

(defn #^String html-header [date]
Expand Down

0 comments on commit 785dc4b

Please sign in to comment.