add center

This commit is contained in:
Gered 2014-03-23 11:27:08 -04:00
parent 04c442a8f8
commit a45bb27479
2 changed files with 12 additions and 0 deletions

View file

@ -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

View file

@ -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")))