summaryrefslogtreecommitdiff
path: root/src/mulk/benki/util.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/mulk/benki/util.clj')
-rw-r--r--src/mulk/benki/util.clj26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/mulk/benki/util.clj b/src/mulk/benki/util.clj
index 5b2e484..c2729f9 100644
--- a/src/mulk/benki/util.clj
+++ b/src/mulk/benki/util.clj
@@ -1,6 +1,7 @@
(ns mulk.benki.util
(:refer-clojure)
- (:use [hiccup core page-helpers]
+ (:use [hiccup core page-helpers]
+ [clojure.core.match.core :only [match]]
noir.core))
@@ -21,6 +22,27 @@
;; defpartial is just defn + html.
(defpartial layout [title & content]
(html5
- [:head [:title title]]
+ [:head
+ [:title title]
+ ;; jQuery
+ [:script {:type "text/javascript"
+ :src (resolve-uri "/3rdparty/jquery/jquery-1.7.min.js")}]
+ ;; Aloha Editor
+ [:link {:rel "stylesheet"
+ :href (resolve-uri "/3rdparty/alohaeditor/aloha/css/aloha.css")}]
+ [:script {:type "text/javascript"
+ :src (resolve-uri "/3rdparty/alohaeditor/aloha/lib/aloha.js")
+ :data-aloha-plugins "common/format,common/highlighteditables,common/list,common/link,common/undo,common/paste,common/block"}]
+ ;; JavaScript
+ [:script {:type "text/javascript"
+ :src (resolve-uri "/js/wiki.js")}]]
[:body [:h1 title]
content]))
+
+
+(defn fresolve [s & args]
+ (resolve-uri (apply fmt nil s args)))
+
+(defn link [& args]
+ (match [(vec args)]
+ [[:wiki title & xs]] (fresolve "/wiki/~a~@[?~a~]" title (name (first xs)))))