You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/content/docs/_index.md
+13-14Lines changed: 13 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -789,21 +789,20 @@ the `from` string replaced with the `to` string.
789
789
Example: `{{ name | replace(from="Robert", to="Bob")}}`
790
790
791
791
#### addslashes
792
-
Adds slashes before quotes.
792
+
Adds slashes before single quote (`'`), double quote (`"`) and slash (`\`) chars.
793
793
794
794
Example: `{{ value | addslashes }}`
795
795
796
-
If value is "I'm using Tera", the output will be "I\\'m using Tera".
796
+
If value is \`Alice said, "I'm using \\ in Tera"\`, the output will be \`Alice said, \\"I\\'m using \\\\ in Tera\\"\`.
797
797
798
798
#### slugify
799
799
Only available if the `builtins` feature is enabled.
800
800
801
-
Transforms a string into ASCII, lowercases it, trims it, converts spaces to hyphens and
802
-
removes all characters that are not numbers, lowercase letters or hyphens.
801
+
Transforms a string into ASCII, lowercases it, trims it, converts all characters that are not numbers or lowercase letters to hyphens, replaces continuous sequence of hyphens with a single hyphen and removes leading and trailing hyphens if any.
803
802
804
803
Example: `{{ value | slugify }}`
805
804
806
-
If value is "-Hello world! ", the output will be "hello-world".
805
+
If value is " -This-- Is तेरा! ", the output will be "this-is-teraa".
807
806
808
807
#### title
809
808
Capitalizes each word inside a sentence.
@@ -822,16 +821,16 @@ Removes leading whitespace if the variable is a string.
822
821
Removes trailing whitespace if the variable is a string.
823
822
824
823
#### trim_start_matches
825
-
Removes leading characters that match the given pattern if the variable is a string.
824
+
Repeatedly removes leading characters that match the given pattern if the variable is a string.
826
825
827
-
Example: `{{ value | trim_start_matches(pat="//") }}`
826
+
Example: `{{ value | trim_start_matches(pat="/") }}`
828
827
829
828
If value is "//a/b/c//", the output will be "a/b/c//".
830
829
831
830
#### trim_end_matches
832
-
Removes trailing characters that match the given pattern if the variable is a string.
831
+
Repeatedly removes trailing characters that match the given pattern if the variable is a string.
833
832
834
-
Example: `{{ value | trim_end_matches(pat="//") }}`
833
+
Example: `{{ value | trim_end_matches(pat="/") }}`
835
834
836
835
If value is "//a/b/c//", the output will be "//a/b/c".
837
836
@@ -888,14 +887,14 @@ Returns the last element of an array.
888
887
If the array is empty, returns empty string.
889
888
890
889
#### nth
891
-
Returns the nth element of an array.§
890
+
Returns the nth element of an array.
892
891
If the array is empty, returns empty string.
893
892
It takes a required `n` argument, corresponding to the 0-based index you want to get.
894
893
895
894
Example: `{{ value | nth(n=2) }}`
896
895
897
896
#### join
898
-
Joins an array with a string.
897
+
Joins an array as a string.
899
898
900
899
Example: `{{ value | join(sep=" // ") }}`
901
900
@@ -910,10 +909,10 @@ Returns a reversed string or array.
910
909
#### sort
911
910
Sorts an array into ascending order.
912
911
913
-
The values in the array must be a sortable type:
914
-
- numbers are sorted by their numerical value.
912
+
All the values in the array must be of same type (either numbers, strings, arrays or bools):
913
+
- numbers are sorted by their numerical values.
915
914
- strings are sorted in alphabetical order.
916
-
- arrays are sorted by their length.
915
+
- arrays are sorted by their lengths.
917
916
- bools are sorted as if false=0 and true=1
918
917
919
918
If you need to sort a list of structs or tuples, use the `attribute`
0 commit comments