add center
This commit is contained in:
parent
04c442a8f8
commit
a45bb27479
|
@ -29,6 +29,10 @@
|
||||||
{:fn (fn [s]
|
{:fn (fn [s]
|
||||||
(WordUtils/capitalize s))}
|
(WordUtils/capitalize s))}
|
||||||
|
|
||||||
|
"center"
|
||||||
|
{:fn (fn [s size & [padding-string]]
|
||||||
|
(StringUtils/center s size (or padding-string " ")))}
|
||||||
|
|
||||||
"dump"
|
"dump"
|
||||||
{:fn (fn [x]
|
{:fn (fn [x]
|
||||||
(with-out-str
|
(with-out-str
|
||||||
|
|
|
@ -288,6 +288,14 @@
|
||||||
(is (= (render "{{ capitalize_all('hello world') }}" nil)
|
(is (= (render "{{ capitalize_all('hello world') }}" nil)
|
||||||
"Hello World")))
|
"Hello World")))
|
||||||
|
|
||||||
|
(testing "center"
|
||||||
|
(is (= (render "{{ center('bat', 5) }}" nil)
|
||||||
|
" bat "))
|
||||||
|
(is (= (render "{{ center('bat', 3) }}" nil)
|
||||||
|
"bat"))
|
||||||
|
(is (= (render "{{ center('bat', 5, 'x') }}" nil)
|
||||||
|
"xbatx")))
|
||||||
|
|
||||||
(testing "dump"
|
(testing "dump"
|
||||||
(is (= (render "{{ a|dump }}" {:a [{:foo "bar"} [1, 2, 3] "hello"]})
|
(is (= (render "{{ a|dump }}" {:a [{:foo "bar"} [1, 2, 3] "hello"]})
|
||||||
"({\"foo\" \"bar\"} (1 2 3) \"hello\")\n")))
|
"({\"foo\" \"bar\"} (1 2 3) \"hello\")\n")))
|
||||||
|
|
Reference in a new issue