diff --git a/src/smeagol/authenticate.clj b/src/smeagol/authenticate.clj
index f4777ff..9b82fcd 100644
--- a/src/smeagol/authenticate.clj
+++ b/src/smeagol/authenticate.clj
@@ -128,7 +128,7 @@
"Return the map of features of this user, if any."
[username]
(if
- (and username (> (count (str username)) 0))
+ (and username (pos? (count (str username))))
((keyword username) (get-users))))
@@ -138,7 +138,7 @@
(timbre/info "Trying to add user " username)
(cond
(not (string? username)) (throw (Exception. "Username must be a string."))
- (= (count username) 0) (throw (Exception. "Username cannot be zero length"))
+ (zero? (count username)) (throw (Exception. "Username cannot be zero length"))
true (let [users (get-users)
user ((keyword username) users)
password (if
@@ -146,7 +146,7 @@
(password/encrypt newpass))
details {:email email
:admin (if
- (and (string? admin) (> (count admin) 0))
+ (and (string? admin) (pos? (count admin)))
true
false)}
;; if we have a valid password we want to include it in the details to update.
diff --git a/src/smeagol/diff2html.clj b/src/smeagol/diff2html.clj
index ea89c91..6cf0dda 100644
--- a/src/smeagol/diff2html.clj
+++ b/src/smeagol/diff2html.clj
@@ -47,16 +47,6 @@
(defn diff2html
"Convert this string, assumed to be in diff format, to HTML."
[^String diff-text]
- (apply str
- (flatten
- (list "
"
- (join "\n"
- (remove nil?
- (map mung-line
- ;; The first five lines are boilerplate, and
- ;; uninteresting for now
- (drop 5
- (split-lines diff-text)))))
- "
"))))
+ (clojure.string/join (flatten (list "" (join "\n" (remove nil? (map mung-line (drop 5 (split-lines diff-text))))) "
"))))
diff --git a/src/smeagol/formatting.clj b/src/smeagol/formatting.clj
index 8ddd6da..6a874c8 100644
--- a/src/smeagol/formatting.clj
+++ b/src/smeagol/formatting.clj
@@ -115,7 +115,7 @@
corresponding inclusion should be inserted."
[index result fragment fragments processed]
(process-text
- (+ index 1)
+ (inc index)
result
fragments
(cons fragment processed)))
@@ -133,18 +133,8 @@
(let
[kw (keyword (str "inclusion-" index))]
(process-text
- (+ index 1)
- (assoc
- result
- :inclusions
- (assoc
- (:inclusions result)
- kw
- (apply
- formatter
- (list
- (subs fragment (count token))
- index))))
+ (inc index)
+ (assoc-in result [:inclusions kw] (apply formatter (list (subs fragment (count token)) index)))
(rest fragments)
(cons kw processed))))
diff --git a/src/smeagol/history.clj b/src/smeagol/history.clj
index ae81fa8..8b65f8f 100644
--- a/src/smeagol/history.clj
+++ b/src/smeagol/history.clj
@@ -41,11 +41,7 @@
[^String log-entry ^String file-path]
(timbre/info (format "searching '%s' for '%s'" log-entry file-path))
(cond
- (not
- (empty?
- (filter
- #(= (first %) file-path)
- (:changed_files log-entry))))
+ (seq (filter (fn* [p1__341301#] (= (first p1__341301#) file-path)) (:changed_files log-entry)))
log-entry))
@@ -121,7 +117,7 @@
new-parse)
(PathFilter/create file-path))
out))))
- (.toString out))))
+ (str out))))
(defn fetch-version
@@ -144,4 +140,4 @@
(throw (IllegalStateException.
(str "Did not find expected file '" file-path "'"))))
(.copyTo (.open repo (.getObjectId tw 0)) out)
- (.toString out)))
+ (str out)))
diff --git a/src/smeagol/routes/wiki.clj b/src/smeagol/routes/wiki.clj
index 6b2e219..a8fad06 100644
--- a/src/smeagol/routes/wiki.clj
+++ b/src/smeagol/routes/wiki.clj
@@ -92,9 +92,7 @@
file-path (cjio/file util/content-dir file-name)
exists? (.exists (cjio/as-file file-path))
user (session/get :user)]
- (if (not exists?)
- (timbre/info (format "File '%s' not found; creating a new file" file-path))
- (timbre/info (format "Opening '%s' for editing" file-path)))
+ (if-not exists? (timbre/info (format "File '%s' not found; creating a new file" file-path)) (timbre/info (format "Opening '%s' for editing" file-path)))
(cond src-text (process-source params suffix request)
true
(layout/render template