diff options
| author | pabs@pablotron.org <pabs@pablotron.org> | 2014-12-18 11:36:53 -0500 | 
|---|---|---|
| committer | pabs@pablotron.org <pabs@pablotron.org> | 2014-12-18 11:36:53 -0500 | 
| commit | eb5302a7981c4e2fc6b7675811a0a913dbe9b91e (patch) | |
| tree | 7d3fff737a35983b4f3667752968150aead6b762 /test.js | |
| parent | c3eef98518978638ba48ed51afc966d1af399b9b (diff) | |
| download | luigi-template-eb5302a7981c4e2fc6b7675811a0a913dbe9b91e.tar.xz luigi-template-eb5302a7981c4e2fc6b7675811a0a913dbe9b91e.zip | |
move javascript to js dir
Diffstat (limited to 'test.js')
| -rw-r--r-- | test.js | 58 | 
1 files changed, 0 insertions, 58 deletions
| diff --git a/test.js b/test.js deleted file mode 100644 index 0fedfcd..0000000 --- a/test.js +++ /dev/null @@ -1,58 +0,0 @@ - -load('luigi-template.js'); - -// define custom template filter -function custom_filter(v) { -  return "foo" + v + "bar"; -} - -function custom_filter_with_args(v, args) { -  var i, l, r = [v]; - -  for (i = 0, l = args.length; i < l; i++) -    r.push(args[i]); - -  return r.join(' and '); -} - -// add custom template filters -LuigiTemplate.FILTERS.custom = custom_filter; -LuigiTemplate.FILTERS.custom_args = custom_filter_with_args; - -// build template string -var template_str = [ -  // test basic templates -  "%{greet}, %{name}!", - -  // test filters and filters with parameters -  "Your name uppercase is: %{name|uc}", - -  // test custom filter -  "Your custom filtered name is: %{name|custom}", - -  // test custom filter with arguments -  "Your custom_args name is: %{name|custom_args foo bar baz}", - -  // test whitespace in filters -  "random test: %{name | lc }", - -  // test pluralize filter -  'pluralize test (0): %{count_0} item%{count_0 | s}', -  'pluralize test (1): %{count_1} item%{count_1 | s}', -  'pluralize test (10): %{count_10} item%{count_10 | s}', - -  // terminating newline -  '' -].join("\n"); - -// build template -var t = new LuigiTemplate(template_str); - -// print results -print(t.run({ -  greet:    'hello', -  name:     'paul', -  count_0:  0, -  count_1:  1, -  count_10: 10 -})); | 
