Add laser.

This commit is contained in:
Anthony Grimes 2013-01-30 04:38:39 -06:00
parent c9070ae749
commit 3ef72c09c3
2 changed files with 61 additions and 45 deletions

View file

@ -10,4 +10,5 @@
[enlive "1.0.0"] [enlive "1.0.0"]
[hiccup "1.0.2"] [hiccup "1.0.2"]
[stencil "0.3.0"] [stencil "0.3.0"]
[tinsel "0.4.0"]]) [tinsel "0.4.0" :exclusions [hickory]]
[me.raynes/laser "0.1.21"]])

View file

@ -3,7 +3,8 @@
tinsel.core) tinsel.core)
(:require [clabango.parser :refer [render render-file]] (:require [clabango.parser :refer [render render-file]]
[stencil.core :as stencil] [stencil.core :as stencil]
[hiccup.core :as hiccup])) [hiccup.core :as hiccup]
[me.raynes.laser :as laser :refer [defdocument]]))
(def bar (str "bar")) (def bar (str "bar"))
@ -59,6 +60,12 @@
(deftemplate simple-tinsel [[:span {:class "foo"}]] [] (has-class? "foo") (set-content bar)) (deftemplate simple-tinsel [[:span {:class "foo"}]] [] (has-class? "foo") (set-content bar))
(deftemplate list-tinsel [[:ul]] [ceil] (tag= :ul) (set-content (for [x (range 1 ceil)] [:li x]))) (deftemplate list-tinsel [[:ul]] [ceil] (tag= :ul) (set-content (for [x (range 1 ceil)] [:li x])))
(defdocument simple-laser "<span class=\"foo\"></span>" []
(laser/class= "foo") (laser/content bar))
(defdocument list-laser "<ul></ul>" [ceil]
(laser/element= :ul) (laser/html-content
(for [x (range 1 ceil)]
(laser/node :li :content (str x)))))
(defn simple-enlive [] (defn simple-enlive []
(str "")) (str ""))
@ -72,53 +79,53 @@
;; (println (count (list-filler-hiccup))) ;; (println (count (list-filler-hiccup)))
;; (println (count (list-filler-clabango-no-fd))) ;; (println (count (list-filler-clabango-no-fd)))
;; (println "\n\n ***** str benchmarks ***** \n\n") (println "\n\n ***** str benchmarks ***** \n\n")
;; (with-progress-reporting (quick-bench (simple-str))) (with-progress-reporting (quick-bench (simple-str)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-str 50))) (with-progress-reporting (quick-bench (list-str 50)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-str 1000))) (with-progress-reporting (quick-bench (list-str 1000)))
;; (println "\n --- \n") (println "\n --- \n")
;; (println "\n\n ***** hiccup benchmarks ***** \n\n") (println "\n\n ***** hiccup benchmarks ***** \n\n")
;; (with-progress-reporting (quick-bench (simple-hiccup))) (with-progress-reporting (quick-bench (simple-hiccup)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-hiccup 50))) (with-progress-reporting (quick-bench (list-hiccup 50)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-hiccup 1000))) (with-progress-reporting (quick-bench (list-hiccup 1000)))
;; (println "\n --- \n") (println "\n --- \n")
;; (println "\n\n ***** clabango string ***** \n\n") (println "\n\n ***** clabango string ***** \n\n")
;; (quick-bench (simple-clabango-no-fd)) (quick-bench (simple-clabango-no-fd))
;; (println "\n --- \n") (println "\n --- \n")
;; (quick-bench (list-clabango-no-fd 50)) (quick-bench (list-clabango-no-fd 50))
;; (println "\n --- \n") (println "\n --- \n")
;; (quick-bench (list-clabango-no-fd 1000)) (quick-bench (list-clabango-no-fd 1000))
;; (println "\n --- \n") (println "\n --- \n")
;; (println "\n\n ***** clabango from file template ***** \n\n") (println "\n\n ***** clabango from file template ***** \n\n")
;; (with-progress-reporting (quick-bench (simple-clabango))) (with-progress-reporting (quick-bench (simple-clabango)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-clabango 50))) (with-progress-reporting (quick-bench (list-clabango 50)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-clabango 1000))) (with-progress-reporting (quick-bench (list-clabango 1000)))
;; (println "\n --- \n") (println "\n --- \n")
;; (println "\n\n ***** stencil string ***** \n\n") (println "\n\n ***** stencil string ***** \n\n")
;; (with-progress-reporting (quick-bench (simple-stencil-no-fd))) (with-progress-reporting (quick-bench (simple-stencil-no-fd)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-stencil-no-fd 50))) (with-progress-reporting (quick-bench (list-stencil-no-fd 50)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-stencil-no-fd 1000))) (with-progress-reporting (quick-bench (list-stencil-no-fd 1000)))
;; (println "\n --- \n") (println "\n --- \n")
;; (println "\n\n ***** stencil file ***** \n\n") (println "\n\n ***** stencil file ***** \n\n")
;; (with-progress-reporting (quick-bench (simple-stencil))) (with-progress-reporting (quick-bench (simple-stencil)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-stencil 50))) (with-progress-reporting (quick-bench (list-stencil 50)))
;; (println "\n --- \n") (println "\n --- \n")
;; (with-progress-reporting (quick-bench (list-stencil 1000))) (with-progress-reporting (quick-bench (list-stencil 1000)))
;; (println "\n --- \n") (println "\n --- \n")
(println "\n\n ***** tinsel ***** \n\n") (println "\n\n ***** tinsel ***** \n\n")
(with-progress-reporting (quick-bench (simple-tinsel))) (with-progress-reporting (quick-bench (simple-tinsel)))
@ -127,4 +134,12 @@
(println "\n --- \n") (println "\n --- \n")
(with-progress-reporting (quick-bench (list-tinsel 1000))) (with-progress-reporting (quick-bench (list-tinsel 1000)))
(println "\n --- \n") (println "\n --- \n")
(println "\n\n ***** laser ***** \n\n")
(with-progress-reporting (quick-bench (simple-laser)))
(println "\n --- \n")
(with-progress-reporting (quick-bench (list-laser 50)))
(println "\n --- \n")
(with-progress-reporting (quick-bench (list-laser 1000)))
(println "\n --- \n")
) )