This commit is contained in:
Michiel Borkent 2020-03-21 17:27:41 +01:00
parent 6aa2389e6f
commit ce028644fc
3 changed files with 40 additions and 0 deletions

View file

@ -844,6 +844,24 @@ $ bb -e "(require '[lambdaisland.regal :as regal]) (regal/regex [:* \"ab\"])"
A clojure configuration libary. Latest test version: `"0.1.16"`.
#### [comb](https://github.com/weavejester/comb)
Simple templating system for Clojure. Latest tested version: `"0.1.1"`.
``` clojure
$ export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {comb {:mvn/version "0.1.1"}}}')
$ rlwrap bb
...
user=> (require '[comb.template :as template])
user=> (template/eval "<% (dotimes [x 3] %>foo<% ) %>")
"foofoofoo"
user=> (template/eval "Hello <%= name %>" {:name "Alice"})
"Hello Alice"
user=> (def hello (template/fn [name] "Hello <%= name %>"))
user=> (hello "Alice")
"Hello Alice"
```
### Blogs
- [Babashka: a quick example](https://juxt.pro/blog/posts/babashka.html) by Malcolm Sparks

21
script/lib_tests/comb_test Executable file
View file

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -eo pipefail
export BABASHKA_CLASSPATH=$(clojure -Spath -Sdeps '{:deps {comb {:mvn/version "0.1.1"}}}')
if [ "$BABASHKA_TEST_ENV" = "native" ]; then
BB_CMD="./bb"
else
BB_CMD="lein bb"
fi
$BB_CMD '
(ns foo (:require [comb.template :as template]))
(prn (template/eval "<% (dotimes [x 3] %>foo<% ) %>"))
(prn (template/eval "Hello <%= name %>" {:name "Alice"}))
(def hello
(template/fn [name] "Hello <%= name %>"))
(prn (hello "Alice"))
'

View file

@ -10,3 +10,4 @@ script/lib_tests/regal_test
script/lib_tests/medley_test
script/lib_tests/babashka_curl_test
script/lib_tests/cprop_test
script/lib_tests/comb_test