You can optionally provide an \{{else}} section which will display only when the list is empty.
+
+
When looping through items in each, you can optionally reference the current loop index via \{{@index}}
-
+
+
Example:
-
+
+
output:
-
+
+
Additionally for object iteration, \{{@key}} references the current key name:
-
+
+
Example:
-
+
+
output:
-
+
+
The first and last steps of iteration are noted via the @first and @last variables when iterating over an array.
When iterating over an object only the @first is available.
@@ -96,13 +109,14 @@
To access the parent index, for example, \{{@../index}} can be used.
The each helper also supports block parameters, allowing for named references anywhere in the block.
-
+
+
Will create a key and value variable that children may access without the need for depth variable references.
In the example above, \{{key}} is identical to \{{@../key}} but in many cases is more readable.
You can use the 'if' helper to conditionally render a block.
If its argument returns false, undefined, null, "", 0, or [], Handlebars will not render the block.
-
+
+
Example:
-
+
+
will result in:
-
+
+
output:
John Samuel
When used with an empty ({}) context, author will be undefined, resulting in:
-
+
+
When using a block expression, you can specify a template section to run if the expression returns a falsy value.
- The section, marked by \{{else}} is called an "else section".
+ The section, marked by \{{else}} is called an "else section".
-
+
+
Lets see an example which render the else section:
Normally, Handlebars templates are evaluated against the context passed into the compiled method.
-
+
+
will result in:
-
- <p>Johnson, Alan</p>
-
+
You can shift the context for a section of a template by using the 'with' helper.
-
+
+
For example:
-
+
+
will result in:
-
+
+
output:
My first post!
@@ -49,23 +54,24 @@
'with' can also be used with block parameters to define known references in the current block.
The example above can be converted to,
-
+
+
which allows for complex templates to potentially provide clearer code than ../ depth references allow for.
You can optionally provide an \{{else}} section which will display only when the passed value is empty.
Truncates a string if it is longer than the specified number of characters. Truncated strings will end with a
+ translatable ellipsis sequence ("...").
+
+
+
+
value - string to truncate
+
size - number of characters to show
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/abbreviate.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/abbreviate.js
new file mode 100644
index 00000000..13df2e6c
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/abbreviate.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Handlebars rocks",
+ size: 13
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize-first.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize-first.hbs
new file mode 100644
index 00000000..1af22dbf
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize-first.hbs
@@ -0,0 +1,40 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Capitalize-First | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
capitalizeFirst Helper
+
+
Capitalizes the first character of a sentence.
+
+
+
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize-first.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize-first.js
new file mode 100644
index 00000000..8362d3b1
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize-first.js
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "handlebars.java"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize.hbs
new file mode 100644
index 00000000..d37a560f
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize.hbs
@@ -0,0 +1,41 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Capitalize | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
capitalize Helper
+
+
Capitalizes all the whitespace separated words in a String.
+
+
+
+
value - string to capitalize
+
fully - optional boolean to identify whether to fully capitalize the string or not
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize.js
new file mode 100644
index 00000000..e2b5133f
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/capitalize.js
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "my first post"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/center.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/center.hbs
new file mode 100644
index 00000000..f27b4685
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/center.hbs
@@ -0,0 +1,42 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Center | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
center Helper
+
+
Center the value in a field of a given width.
+
+
+
+
value - string to center
+
size - size of the final string
+
pad - string to be used as padding
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/center.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/center.js
new file mode 100644
index 00000000..822bf416
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/center.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "handlebars.java",
+ size: 19
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/cut.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/cut.hbs
new file mode 100644
index 00000000..c0262617
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/cut.hbs
@@ -0,0 +1,42 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Cut | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
cut Helper
+
+
Remove all values of arg from the given string.
+
+
+
+
value - string to be processed
+
arg - string which should be removed from the value string
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
+
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/cut.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/cut.js
new file mode 100644
index 00000000..6e6f5112
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/cut.js
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "String with spaces"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/date-format.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/date-format.hbs
new file mode 100644
index 00000000..40eb240d
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/date-format.hbs
@@ -0,0 +1,27 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Date Format | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
dateFormat Helper
+
+
Formats the given date.
+
+
+
+
date - date to be formatted
+
+
You can format date using one of the following format parameters:
+
+
full - full date format. For example: Tuesday, June 19, 2012
+
long - long date format. For example: June 19, 2012
+
medium - medium date format. For example: Jun 19, 2012
+
short - short date format. For example: 6/19/12
+
pattern - a date pattern.
+
+ Otherwise, the default formatter will be used. The format option can be specified as a parameter or hash (a.k.a
+ named parameter).
+
Assign a default value to a string if the string is evaluated as false.
+
+
+
+
value - string to be evaluated
+
arg - default value
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/default-if-empty.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/default-if-empty.js
new file mode 100644
index 00000000..76b63365
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/default-if-empty.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "",
+ default: "nothing"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/index.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/index.hbs
new file mode 100644
index 00000000..cfba011c
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/index.hbs
@@ -0,0 +1,30 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "String Helpers | " @config.appName}}
+
+{{#fillZone "content"}}
+
Joins an array, iterator or an iterable with a string.
+
+
+
+
value - items to be concatenated (space separated values)
+
separator - item separator string
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/join.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/join.js
new file mode 100644
index 00000000..d26ee975
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/join.js
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ a: "a",
+ b: "b",
+ c: "c",
+ separator: " // "
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/ljust.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/ljust.hbs
new file mode 100644
index 00000000..04d38f79
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/ljust.hbs
@@ -0,0 +1,42 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "LJust | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
ljust Helper
+
+
Left align the value in a field of a given width.
+
+
+
+
value - string to be aligned
+
size - size of the final string
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/ljust.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/ljust.js
new file mode 100644
index 00000000..01fb04c2
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/ljust.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Handlebars.java",
+ size: 20
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/lower.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/lower.hbs
new file mode 100644
index 00000000..09793bf4
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/lower.hbs
@@ -0,0 +1,40 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Lower | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
lower Helper
+
+
Convert a string to lowercase.
+
+
+
+
value - string to be converted
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/lower.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/lower.js
new file mode 100644
index 00000000..a6f1cfef
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/lower.js
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "HELLO"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/now.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/now.hbs
new file mode 100644
index 00000000..3f279c8f
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/now.hbs
@@ -0,0 +1,25 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Now | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
now Helper
+
+
Add the current date.
+
+
+
+
+
Format parameters is one of:
+
+
full - full date format. For example: Tuesday, June 19, 2012
+
long - long date format. For example: June 19, 2012
+
medium - medium date format. For example: Jun 19, 2012
Replaces each substring of this string that matches the literal target sequence with the specified literal
+ replacement sequence.
+
+
+
+
value - string to be processed
+
target - target string to be removed
+
replacement - replacement string for the target string
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/replace.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/replace.js
new file mode 100644
index 00000000..16959f47
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/replace.js
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Handlebars ...",
+ target: "...",
+ replacement: "rocks"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/rjust.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/rjust.hbs
new file mode 100644
index 00000000..e32ac594
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/rjust.hbs
@@ -0,0 +1,42 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Rjust | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
rjust Helper
+
+
Right align the value in a field of a given width.
+
+
+
+
value - string to be aligned
+
size - size of the final string
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/rjust.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/rjust.js
new file mode 100644
index 00000000..01fb04c2
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/rjust.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Handlebars.java",
+ size: 20
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/slugify.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/slugify.hbs
new file mode 100644
index 00000000..9e70a337
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/slugify.hbs
@@ -0,0 +1,41 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Slugify | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
slugify Helper
+
+
Converts a value to lowercase, remove non-word characters (alphanumerics and underscores) and convert
+ spaces to hyphens. Also strip leading and trailing whitespace.
+
+
+
+
value - string to be processed
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/slugify.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/slugify.js
new file mode 100644
index 00000000..754d7dd1
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/slugify.js
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Joel is a slug"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/string-format.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/string-format.hbs
new file mode 100644
index 00000000..4193e95d
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/string-format.hbs
@@ -0,0 +1,42 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "String Format | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
stringFormat Helper
+
+
Formats the variable according to a string formatting specifier.
+
+
+
+
value - formatting specifier
+
params - list of parameters
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/string-format.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/string-format.js
new file mode 100644
index 00000000..f6c64f7f
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/string-format.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Hello %s",
+ param: "handlebars.java"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/strip-tags.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/strip-tags.hbs
new file mode 100644
index 00000000..20d43553
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/strip-tags.hbs
@@ -0,0 +1,16 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Strip Tags | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
Get a character sequence that is sub sequence of the given sequence. The sub sequence starts with the character
+ value at the specified index and ends with the character value at the index end-1.
+
+
+
+
value - string to be processed
+
start - start offset
+
end - end offset
+
+
+
+
Example 1
+
+
when used with this context:
+
+
will result in:
+
+
+
+
+
Example 2
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/substring.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/substring.js
new file mode 100644
index 00000000..6b62df43
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/substring.js
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Handlebars.java",
+ start1: 11,
+ start2: 0,
+ end2: 10
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/upper.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/upper.hbs
new file mode 100644
index 00000000..dfecb704
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/upper.hbs
@@ -0,0 +1,40 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Upper | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
lower Helper
+
+
Convert a string to uppercase.
+
+
+
+
value - string to be converted
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/upper.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/upper.js
new file mode 100644
index 00000000..1e1e2003
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/upper.js
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Hello"
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/word-wrap.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/word-wrap.hbs
new file mode 100644
index 00000000..1de591f6
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/word-wrap.hbs
@@ -0,0 +1,38 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Word Wrap | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
wordWrap Helper
+
+
Wraps words at specified line length.
+
+
+
+
value - string to be wrapped
+
size - number of characters at which to wrap the text
+
+
+
+
Example
+
+
when used with this context:
+
+
will result in:
+
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/word-wrap.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/word-wrap.js
new file mode 100644
index 00000000..11ea2f8a
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/word-wrap.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "Joel is a slug",
+ size: 5
+ };
+}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/yesno.hbs b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/yesno.hbs
new file mode 100644
index 00000000..38ef3e9f
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/yesno.hbs
@@ -0,0 +1,16 @@
+{{layout "org.wso2.carbon.uuf.sample.foundation.main"}}
+{{title "Yes No | String Helper Sample | " @config.appName}}
+{{fragment "org.wso2.carbon.uuf.sample.foundation.highlight" theme=@config.highlightjsTheme}}
+
+{{#fillZone "content"}}
+
yesno Helper
+
+
Map values for true, false and (optionally) null, to the strings "yes", "no", "maybe".
+
+
+
+
value - string to be mapped
+
+{{/fillZone}}
diff --git a/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/yesno.js b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/yesno.js
new file mode 100644
index 00000000..9b5e2f57
--- /dev/null
+++ b/samples/apps/org.wso2.carbon.uuf.sample.features-app/src/main/pages/helpers/string-helpers/yesno.js
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+function onRequest(env) {
+ return {
+ value: "yes"
+ };
+}