+
+
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
+
-
+
-
+
+
+
-
-
+
+
+
+
+
\ No newline at end of file
diff --git a/src/smeagol/extensions/photoswipe.clj b/src/smeagol/extensions/photoswipe.clj
index 1330cf4..d30375a 100644
--- a/src/smeagol/extensions/photoswipe.clj
+++ b/src/smeagol/extensions/photoswipe.clj
@@ -9,6 +9,8 @@
[instaparse.core :as insta]
[me.raynes.fs :as fs]
[noir.io :as io]
+ [selmer.parser :refer [render]]
+ [selmer.util :refer [without-escaping]]
[smeagol.configuration :refer [config]]
[smeagol.extensions.utils :refer :all]
[smeagol.util :refer [content-dir upload-dir]]
@@ -41,31 +43,11 @@
"Process a specification for a photoswipe gallery, using a JSON
specification based on that documented on the Photoswipe website."
[^String spec ^Integer index]
- (str
- "
-
\n"
+ (without-escaping
+ (render
(slurp
- (str (io/resource-path) "html-includes/photoswipe-boilerplate.html"))
- "
-
-
-
"))
+ (str (io/resource-path) "html-includes/photoswipe-boilerplate.html"))
+ {:spec spec :index index})))
(def simple-grammar
diff --git a/src/smeagol/history.clj b/src/smeagol/history.clj
index e567db3..3e38e3c 100644
--- a/src/smeagol/history.clj
+++ b/src/smeagol/history.clj
@@ -6,11 +6,17 @@
[clj-jgit.querying :as q]
[taoensso.timbre :as log])
(:import [org.eclipse.jgit.api Git]
- [org.eclipse.jgit.lib Repository ObjectId]
- [org.eclipse.jgit.revwalk RevCommit RevTree RevWalk]
- [org.eclipse.jgit.treewalk TreeWalk AbstractTreeIterator CanonicalTreeParser]
+ [org.eclipse.jgit.lib
+ ;; Repository
+ ObjectId]
+ ;; [org.eclipse.jgit.revwalk RevCommit RevTree RevWalk]
+ [org.eclipse.jgit.treewalk TreeWalk
+ ;; AbstractTreeIterator
+ CanonicalTreeParser]
[org.eclipse.jgit.treewalk.filter PathFilter]
- [org.eclipse.jgit.diff DiffEntry DiffFormatter]))
+ [org.eclipse.jgit.diff
+ ;; DiffEntry
+ DiffFormatter]))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;
@@ -55,9 +61,9 @@
(git/load-repo git-directory-path)
(catch java.io.FileNotFoundException fnf
(log/info "Initialising Git repository at" git-directory-path)
- (git/git-init git-directory-path)
+ (git/git-init :dir git-directory-path)
(let [repo (git/load-repo git-directory-path)]
- (git/git-add-and-commit repo "Initial commit")
+ (git/git-commit repo "Initial commit")
repo))))
diff --git a/src/smeagol/repl.clj b/src/smeagol/repl.clj
index 58b3efb..d847e6a 100644
--- a/src/smeagol/repl.clj
+++ b/src/smeagol/repl.clj
@@ -45,7 +45,7 @@
(defn start-server
"used for starting the server in development mode from REPL"
[& [port]]
- (let [port (if port (Integer/parseInt port) 3000)]
+ (let [port (if port (Integer/parseInt (str port)) 3000)]
(reset! server
(serve (get-handler)
{:port port
@@ -58,3 +58,6 @@
(defn stop-server []
(.stop @server)
(reset! server nil))
+
+;;(start-server 4444)
+
diff --git a/src/smeagol/routes/wiki.clj b/src/smeagol/routes/wiki.clj
index e5ae10a..876fe87 100644
--- a/src/smeagol/routes/wiki.clj
+++ b/src/smeagol/routes/wiki.clj
@@ -75,7 +75,7 @@
(log/info (format "Saving %s's changes ('%s') to %s in file '%s'" user summary page file-path))
(spit file-path source-text)
(git/git-add git-repo file-name)
- (git/git-commit git-repo summary {:name user :email email})
+ (git/git-commit git-repo summary :name user :email email)
(response/redirect
(str
"/wiki?page="
diff --git a/src/smeagol/util.clj b/src/smeagol/util.clj
index ec37e06..1587f5b 100644
--- a/src/smeagol/util.clj
+++ b/src/smeagol/util.clj
@@ -79,15 +79,15 @@
(cjio/file local-url-base file-path))]
(cond
(cs/includes? file-path "..")
- (cs/join " " file-path
- "Attempts to ascend the file hierarchy are disallowed.")
+ (cs/join " " [file-path
+ "Attempts to ascend the file hierarchy are disallowed."])
(not (cs/starts-with? path local-url-base))
(cs/join " " [path "is not servable"])
(not (fs/exists? path))
(cs/join " " [path "does not exist"])
(not (fs/readable? path))
(cs/join " " [path "is not readable"])))
- (catch Exception any (cs/join " " file-path "is not servable because" (.getMessage any)))))
+ (catch Exception any (cs/join " " [file-path "is not servable because" (.getMessage any)]))))
;; (not-servable-reason "/home/simon/workspace/smeagol/resources/public/content/vendor/node_modules/photoswipe/dist/photoswipe.min.js")
@@ -157,8 +157,10 @@
(defn get-servlet-context-path
+ "Return the servlet context path, if we're running as a servlet; if
+ not, return `nil`."
[request]
- (if-let [context (:servlet-context request)]
+ (when-let [context (:servlet-context request)]
;; If we're not inside a serlvet environment (for
;; example when using mock requests), then
;; .getContextPath might not exist