fhd / clostache

{{ mustache }} for Clojure
GNU Lesser General Public License v3.0
318 stars 62 forks source link

Check for Seqable in render-section #26

Closed JulianBirch closed 11 years ago

JulianBirch commented 11 years ago

In particular, at the moment it's not possible to render sorted-maps, which is actually pretty useful.

(def l [{:x 1} {:x 5} {:x 3}])
(def l2 (apply sorted-set-by #(compare (:x %1) (:x %2)) l))

(clostache.parser/render "{{#y}}{{x}}{{/y}}" {:y l})
; "153"
(clostache.parser/render "{{#y}}{{x}}{{/y}}" {:y l2})
; "", should have been "135"

Hope you agree this needs fixing. Will try to put together a patch for it myself.

JulianBirch commented 11 years ago

Dupe of #27.