Skip to content

Commit 903d2a2

Browse files
committed
Improvement to docs (Keats#698)
* Docs : Clarify `addslashes` filter * Docs : Clarify `slugify` filter * Docs : Clarify `trim_start_matches` & `trim_end_matches` filters
1 parent 3f48bd2 commit 903d2a2

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

docs/content/docs/_index.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -789,21 +789,20 @@ the `from` string replaced with the `to` string.
789789
Example: `{{ name | replace(from="Robert", to="Bob")}}`
790790

791791
#### addslashes
792-
Adds slashes before quotes.
792+
Adds slashes before single quote (`'`), double quote (`"`) and slash (`\`) chars.
793793

794794
Example: `{{ value | addslashes }}`
795795

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\\"\`.
797797

798798
#### slugify
799799
Only available if the `builtins` feature is enabled.
800800

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.
803802

804803
Example: `{{ value | slugify }}`
805804

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".
807806

808807
#### title
809808
Capitalizes each word inside a sentence.
@@ -822,16 +821,16 @@ Removes leading whitespace if the variable is a string.
822821
Removes trailing whitespace if the variable is a string.
823822

824823
#### 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.
826825

827-
Example: `{{ value | trim_start_matches(pat="//") }}`
826+
Example: `{{ value | trim_start_matches(pat="/") }}`
828827

829828
If value is "//a/b/c//", the output will be "a/b/c//".
830829

831830
#### 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.
833832

834-
Example: `{{ value | trim_end_matches(pat="//") }}`
833+
Example: `{{ value | trim_end_matches(pat="/") }}`
835834

836835
If value is "//a/b/c//", the output will be "//a/b/c".
837836

0 commit comments

Comments
 (0)