From 517d096b1b84ce5d7fab83b83127e55d17e99862 Mon Sep 17 00:00:00 2001 From: Cosmin Popovici Date: Wed, 6 May 2020 12:19:26 +0300 Subject: [PATCH] docs: update readme.md --- README.md | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 100 insertions(+) diff --git a/README.md b/README.md index 135ba3a..0ad6eca 100644 --- a/README.md +++ b/README.md @@ -173,6 +173,35 @@ else p Foo is probably just foo in the end. ``` +#### `conditionalTags` + +Type: `array`\ +Default: `['if', 'elseif', 'else']` + +You can define custom tag names to use for creating a conditional. + +Example: + +```js +conditionalTags: ['when', 'elsewhen', 'otherwise'] +``` + +```html + +

Foo really is bar! Revolutionary!

+
+ + +

Foo is wow, oh man.

+
+ + +

Foo is probably just foo in the end.

+
+``` + +Note: tag names must be in the exact order as the default ones. + ### Switch statement Switch statements act like streamline conditionals. They are useful for when you want to compare a single variable against a series of constants. @@ -201,6 +230,35 @@ locals: { foo: 'foo' } Anything in the `expression` attribute is evaluated directly as an expressions. +#### `switchTags` + +Type: `array`\ +Default: `['switch', 'case', 'default']` + +You can define custom tag names to use when creating a switch. + +Example: + +```js +switchTags: ['clause', 'when', 'fallback'] +``` + +```html + + +

Foo really is bar! Revolutionary!

+
+ +

Foo is wow, oh man.

+
+ +

Foo is probably just foo in the end.

+
+
+``` + +Note: tag names must be in the exact order as the default ones. + ### Loops You can use the `each` tag to build loops. It works with both arrays and objects. For example: @@ -246,6 +304,27 @@ The value of the `loop` attribute is not a pure expressions evaluation, and it d So you don't need to declare all the available variables (in this case, the index is skipped), and the expressions after `in` doesn't need to be a local variable, it can be any expressions. +#### `loopTags` + +Type: `array`\ +Default: `['each']` + +You can define custom tag names to use for creating loops: + +Example: + +```js +loopTags: ['each', 'for'] +``` + +You can now also use the `` tag when writing a loop: + +```html + +

{{ item }}

+
+``` + #### Loop meta Inside a loop, you have access to a special `loop` object, which contains information about the loop currently being executed: @@ -297,6 +376,27 @@ locals: { ``` +#### `scopeTags` + +Type: `array`\ +Default: `['scope']` + +You can define a custom tag name to use for creating scopes: + +Example: + +```js +scopeTags: ['context'] +``` + +You can now also use the `` tag when writing a scope: + +```html + + + +``` + ### Ignored tag Anything inside this tag will not be parsed, allowing you to output delimiters and anything the plugin would normally parse, in their original form.