From 564eb78241e3281f0b6464ec01d49486005ab4e5 Mon Sep 17 00:00:00 2001 From: oakes Date: Mon, 30 Jun 2014 12:31:55 -0400 Subject: [PATCH] Don't add hyphens to upper-case strings --- doclet/src/clojure/play_clj_doclet/core.clj | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/doclet/src/clojure/play_clj_doclet/core.clj b/doclet/src/clojure/play_clj_doclet/core.clj index 4114ca4..6d84a08 100644 --- a/doclet/src/clojure/play_clj_doclet/core.clj +++ b/doclet/src/clojure/play_clj_doclet/core.clj @@ -13,9 +13,16 @@ (def classes (-> "classes.edn" io/resource slurp edn/read-string)) +(defn split-string + [s] + (if (= s (string/upper-case s)) + [s] + (string/split s #"(?=[A-Z])"))) + (defn camel->keyword [s] - (->> (string/split (string/replace s "_" "-") #"(?=[A-Z])") + (->> (string/replace s "_" "-") + split-string (map string/lower-case) (string/join "-") keyword))