aboutsummaryrefslogtreecommitdiff
path: root/modules/prxml/src
diff options
context:
space:
mode:
authorBen Smith-Mannschott <bsmith.occs@gmail.com>2010-08-28 11:22:22 +0200
committerStuart Sierra <mail@stuartsierra.com>2010-09-03 12:23:37 -0400
commitfe4ed311166677cd571d23774171af1d830f7fc5 (patch)
tree70d6c519b8afa7bbee51bb8c3e243d4f3903b2e2 /modules/prxml/src
parent034d3d1703d139117b38fe6a10f552e23aa48b5c (diff)
remove deprecated clojure.contrib.string
Since clojure.contrib.string is used by other submodules, some changes were required: - gen-html-docs and prxml needed changes because of functions were renamed or arguments reordered when promoted to clojure.string. - jmx, json, miglayout, prxml and sql gained a private one-argument implementation of as-str. - repl-utils gained a private copy of c.c.string/partition, named spartition. - repl-utils replaced a call to c.c.string/substring? with a call to the java String method '.contains' (with swapped argument order). Signed-off-by: Stuart Sierra <mail@stuartsierra.com>
Diffstat (limited to 'modules/prxml/src')
-rw-r--r--modules/prxml/src/main/clojure/clojure/contrib/prxml.clj18
1 files changed, 12 insertions, 6 deletions
diff --git a/modules/prxml/src/main/clojure/clojure/contrib/prxml.clj b/modules/prxml/src/main/clojure/clojure/contrib/prxml.clj
index 2c2ec761..a680c773 100644
--- a/modules/prxml/src/main/clojure/clojure/contrib/prxml.clj
+++ b/modules/prxml/src/main/clojure/clojure/contrib/prxml.clj
@@ -27,7 +27,7 @@
:doc "Compact syntax for generating XML. See the documentation of \"prxml\"
for details."}
clojure.contrib.prxml
- (:use [clojure.contrib.string :only (escape as-str)]))
+ (:use [clojure.string :only (escape)]))
(def
^{:doc "If true, empty tags will have a space before the closing />"}
@@ -43,11 +43,17 @@ for details."}
(def ^{:private true} print-xml) ; forward declaration
(defn- escape-xml [s]
- (escape {\< "&lt;"
- \> "&gt;"
- \& "&amp;"
- \' "&apos;"
- \" "&quot;"} s))
+ (escape s {\< "&lt;"
+ \> "&gt;"
+ \& "&amp;"
+ \' "&apos;"
+ \" "&quot;"}))
+
+(defn- as-str
+ [x]
+ (if (instance? clojure.lang.Named x)
+ (name x)
+ (str x)))
(defn- prxml-attribute [name value]
(print " ")