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 access by index + update travis cfg #16

Merged
merged 5 commits into from
Dec 22, 2020
Merged
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
30 changes: 18 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
sudo: true
language: java

script:
- cd test; npm install; cd ..
- make test
- make js
- make jstest
- make jar && make clojars-push
- make demo
jdk:
- openjdk11

install:
- curl -O https://download.clojure.org/install/linux-install-1.10.1.466.sh
- chmod +x linux-install-1.10.1.466.sh
- sudo ./linux-install-1.10.1.466.sh
- nvm install 10.16.0

jdk:
- openjdk11

cache:
directories:
- "$HOME/.m2"
Expand All @@ -26,10 +17,25 @@ cache:
- "$TRAVIS_BUILD_DIR/test/node_modules"
- ".cpcache"

script:
- cd test; npm install; cd ..
- make test
- make js
- make jstest
- make jar
- make demo

deploy:
provider: gcs
- provider: gcs
edge: true
bucket: jute-demo-site
skip_cleanup: true
local_dir: demo
acl: public-read
on:
branch: master

- provider: script
script: make clojars-push
on:
branch: master
4 changes: 2 additions & 2 deletions src/jute/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -584,8 +584,8 @@ string-literal
[(fn [val scope is-multiple?]
(if (sequential? val)
(if is-multiple?
(mapv #(get % (if (neg? cmp) (+ (count %) cmp) cmp)) val)
(get val (if (neg? cmp) (+ (count val) cmp) cmp)))
(mapv #(get % (if (neg? cmp) (+ (count %) cmp) cmp)) (vec val))
(get (vec val) (if (neg? cmp) (+ (count val) cmp) cmp)))

(do
(if is-multiple?
Expand Down
7 changes: 7 additions & 0 deletions test/jute/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,10 @@
((compile {:$let {:f {:$fn [:a]
:$body "$ a / 0"}}
:$body {:b "$ f(a)"}}) {:a 1})))))

(deftest index-access-test
(let [data {:scope {:data
'({:name ({:value "one"})}
{:name ({:value "two"})})}
:template {:value "$ data.0.name.0.value"}}]
(is (= {:value "one"} ((compile (:template data)) (:scope data))))))