clojure - Hiccup template function -


i'm trying add following hiccup template function file

(defn d3-page [title js body & {:keys [extra-js] :or {extra-js []}}]         (html5             [:head                 [:title title]             (include-css "/css/nv.d3.css"))             (include-css "/css/style.css")]             [:body         (concat             [body]             [(include-js "http://d3js.org/d3.v3.min.js")              (include-js (str "https://raw.github.com"                               "/novus/nvd3"                               "/master/nv.d3.min.js")]         (map include-js extra-js)             [(include-js "/js/script.js")              (javascript-tag js)])])) 

but keep getting unmatched delimiter when run lein ring server. comes clojure data cookbook, surprised find error , suspect error on end. below rest of code in file:

(ns web-viz.web (:require [compojure.route :as route]       [compojure.handler :as handler]       [clojure.string :as str]) (:use compojure.core   ring.adapter.jetty   [ring.middleware.content-type :only   (wrap-content-type)]   [ring.middleware.file :only (wrap-file)]   [ring.middleware.file-info :only   (wrap-file-info)]   [ring.middleware.stacktrace :only   (wrap-stacktrace)]   [ring.util.response :only (redirect)]   [hiccup core element page]   [hiccup.middleware :only (wrap-base-url)]))   (defn d3-page...as above   ...)   (deftype group [key values])  (deftype point [x y size])   (defn add-label [chart axis label]     (if-not (nil? label)             (.axislabel (aget chart axis) label)))   (defn add-axes-labels [chart x-label y-label]     (doto chart (add-label "xaxis" x-label)                 (add-label "yaxis" y-label)))  (defn populate-node [selector chart groups transition continuation]     (-> (.select js/d3 selector)         (.datum groups)         (.transition)         (.duration (if transition 500 0))         (.call chart)         (.call continuation)))   (defn force-layout-plot []  (d3-page "force-directed layout" "webviz.force.force_layout();" [:div#force.chart [:svg]]))   (defroutes site-routes (get "/force" [] (force-layout-plot)) (get "/force/data.json" [] (redirect "/data/census-race.json")) (route/resources "/") (route/not-found "page not found"))  (def app (-> (handler/site site-routes))) 

in line 5

(include-css "/css/nv.d3.css")) 

there's ) there.

and in line 13,

"/master/nv.d3.min.js")] 

there's 1 ) missing. should

"/master/nv.d3.min.js"))] 

you should use editor can matching of braces, parentheses, , brackets, etc. automatically.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

c# - Unity IoC Lifetime per HttpRequest for UserStore -

I am trying to solve the error message 'incompatible ranks 0 and 1 in assignment' in a fortran 95 program. -