Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX] string are seqable, but (maybe) you want to render it instead o… #57

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
language: clojure
lein: lein2
script: lein2 all test
lein: lein
script: lein all test
before_install:
- git submodule update --init --recursive
jdk:
- openjdk6
- openjdk7
- openjdk8
- oraclejdk7
- oraclejdk8
7 changes: 3 additions & 4 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
(defproject de.ubercode.clostache/clostache "1.5.0-SNAPSHOT"
(defproject de.ubercode.clostache/clostache "1.5.0"
:min-lein-version "2.0.0"
:description "{{ mustache }} for Clojure"
:url "http://github.com/fhd/clostache"
:license {:name "GNU Lesser General Public License 2.1"
:url "http://www.gnu.org/licenses/lgpl-2.1.txt"
:distribution :repo}
:dependencies [[org.clojure/clojure "1.5.0"]
[org.clojure/core.incubator "0.1.2"]]
:dependencies [[org.clojure/clojure "1.9.0"]]
:profiles {:dev {:dependencies [[org.clojure/data.json "0.1.2"]
[jline/jline "0.9.94"]]
:resource-paths ["test-resources"]}
:1.5 {:dependencies [[org.clojure/clojure "1.5.0"]]}}
:1.5 {:dependencies [[org.clojure/clojure "1.9.0"]]}}
:repositories {"clojure-releases" "http://build.clojure.org/releases"}
:aliases {"all" ["with-profile" "dev:dev,1.5"]}
:global-vars {*warn-on-reflection* true})
10 changes: 5 additions & 5 deletions src/clostache/parser.clj
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
(ns clostache.parser
"A parser for mustache templates."
(:use [clojure.string :only (split)]
[clojure.core.incubator :only (seqable?)])
(:refer-clojure :exclude (seqable?))
(:use [clojure.string :only (split)])
(:require [clojure.java.io :as io]
[clojure.string :as str])
(:import java.util.regex.Matcher))
Expand Down Expand Up @@ -334,12 +332,14 @@
(if section-data
(if (fn? section-data)
(let [result (section-data (:body section))]
(if (fn? result)
(if (fn? result)
(result #(render-template % data partials))
result))
(let [section-data (cond (sequential? section-data) section-data
(map? section-data) [section-data]
(seqable? section-data) (seq section-data)
(and
(seqable? section-data)
(not (string? section-data))) (seq section-data)
:else [{}])
section-data (if (map? (first section-data))
section-data
Expand Down