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