Source

neman / neman / xml / examples / xml3.clj

Full commit
(ns user
  (:use
    (net.ksojat.neman
      core
      [web :only [url-for url-for-path *current-path*]]
      [xml :only [render xml xml-node xml-nodes template template-from child]])))


;(def baseh
;  (template
;    (=> :html
;      [(=>> (:head [(child :head) (child :css)])
;            (:body [(child :body) (child :js)]))])))

(def baseh
  (template
    (=> :html
      [(=> :head [(child :head) (child :css)])
       (=> :body [(child :body) (child :js)])])))


(def base
  (template-from baseh
    (:head
      (=> :meta {:http-equiv "Content-Type" :content "text/html; charset=utf-8"})
      (=> :title "Hatchery Alpha")
      ;(shortcut-icon "media/favicon.png")
      (child :head))
    (:css
      (child :css))
    (:js
      (child :js))
    (:body
      (=> :div {:id "main"}
        [(=> :div {:id "header" :class "fluid"}
           [(=> :h1 "Hatchery")
            (=> :p "Experiments in Genetic Algorithms, Procedural Graphics and Functional Languages")])
         (child :body)])

      (=> :div {:id "footer"}
        "© 2008.  Kre\u0161imir \u0160ojat. All right reserved."))))

;(def base2
;  (template-from base
;    (:body
;      (=> :div.fluid#nav
;        [(=> :form.search
;           [(=>> (:label {:for "search"} "Search")
;                 (:input.search {:type "text" :name "search"})
;                 (:input {:type "submit" :value "Go"}))])
;         (=> :div {:class "clear"})])
;      (=> :div [(child :body)]))))

;(def index-template
;  (template-from baseh
;    (:body
;      (=> :a))))

(render base)