From 9b1d5e260aab6f691fa3e2b39704334364a53fa3 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 20 Nov 2011 16:17:57 +0100 Subject: Make Wiki editable. --- src/mulk/benki/util.clj | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) (limited to 'src/mulk/benki/util.clj') 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))))) -- cgit v1.2.3