Skip to content

Commit 9b6c8fa

Browse files
committed
docs: add more info
1 parent 61a4ec3 commit 9b6c8fa

4 files changed

Lines changed: 34 additions & 31 deletions

File tree

docs/versions/v3/language-elements/directives.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,8 @@ In this example, both default and named slots are used within a single component
281281

282282
### Important Notes
283283

284-
1. Defining multiple slots with the same name in a single component will result in an error.
285-
2. Defining multiple default slots in a single component will result in an error.
286-
3. If you provide an empty string as a slot name, it will act as default slot. `@slot` and `@slot('')` act the same.
284+
- Defining multiple default slots or named slots with the same name in a single component will result in an error.
285+
- If you provide an empty string as a slot name, it will act as default slot. `@slot` and `@slot('')` act the same.
287286

288287
## @dump
289288

docs/versions/v3/language-elements/expressions.md

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,14 @@ description: You can find here all the information about expressions in Textwire
55

66
# Expressions
77

8-
- [Ternary expressions](#ternary-expressions) <code v-pre>{{ x ? y : z }}</code>
9-
- [Prefix expressions](#prefix-expressions) <code v-pre>{{ !x` or `-x }}</code>
10-
- [Infix expressions](#infix-expressions) <code v-pre>{{ x * (y + 3) }}</code>
11-
- [Postfix expressions](#postfix-expressions) <code v-pre>{{ x++ }}</code> or <code v-pre>{{ x-- }}</code>
12-
- [Comparison expressions](#comparison-expressions) <code v-pre>{{ x == y }}</code>
8+
- [Ternary](#ternary) <code v-pre>{{ x ? y : z }}</code>
9+
- [Prefix](#prefix) <code v-pre>{{ !x` or `-x }}</code>
10+
- [Infix](#infix) <code v-pre>{{ x * (y + 3) }}</code>
11+
- [Postfix](#postfix) <code v-pre>{{ x++ }}</code> or <code v-pre>{{ x-- }}</code>
12+
- [Comparison](#comparison) <code v-pre>{{ x == y }}</code>
1313
- [Function calls](#function-calls) <code v-pre>{{ name.split(" ") }}</code>
14-
- [Variable Declaration](#variable-declaration) <code v-pre>{{ x = 5 }}</code>
1514

16-
## Ternary Expressions
15+
## Ternary
1716
You can use ternary expressions to conditionally render content. Here is an example of using ternary expressions:
1817

1918
```textwire :no-line-numbers
@@ -22,15 +21,15 @@ You can use ternary expressions to conditionally render content. Here is an exam
2221

2322
The advantage of a "ternary expression" over an "if statement" is that it can be used inside of any other expressions.
2423

25-
## Prefix Expressions
24+
## Prefix
2625
You can use prefix expressions to negate or invert a boolean value. Here is an example of using prefix expressions:
2726

2827
```textwire :no-line-numbers
2928
<span>{{ !isTall ? "Not tall" : "Is tall" }}</span>
3029
<span>{{ -x }}</span>
3130
```
3231

33-
## Infix Expressions
32+
## Infix
3433
You can use infix expressions to perform arithmetic operations. Here is an example of using infix expressions:
3534

3635
```textwire
@@ -44,15 +43,15 @@ You can use infix expressions to perform arithmetic operations. Here is an examp
4443
</ul>
4544
```
4645

47-
## Postfix Expressions
46+
## Postfix
4847
You can use postfix expressions to increment or decrement a variable. Here is an example of using postfix expressions:
4948

5049
```textwire :no-line-numbers
5150
<span>{{ x++ }}</span> <!-- Increment -->
5251
<span>{{ x-- }}</span> <!-- Decrement -->
5352
```
5453

55-
## Comparison Expressions
54+
## Comparison
5655
Comparison expressions produce a boolean value. Here is an example of using comparison expressions:
5756

5857
```textwire :no-line-numbers
@@ -85,19 +84,4 @@ Here is an example of using function calls:
8584
{{ name.split(" ") }}
8685
```
8786

88-
> You can read more detail about built-in functions on the [Built-in Functions](/v3/functions/guide) page.
89-
90-
## Variable Declaration
91-
92-
You can assign and declare variables by using the `=` operator. Here is an example of declaring variables:
93-
94-
```textwire :no-line-numbers
95-
{{ x = 5 }}
96-
{{ x = 10 }}
97-
```
98-
99-
You cannot assign values to variables of a different type. For example, you cannot do <code v-pre>{{ x = "Hello"; x = 3 }}</code> because `x` is a string and then you are trying to assign an integer to it. In Textwire, you don't need to declare type of a variable, it will be automatically inferred from the value that you assign to it.
100-
101-
:::tip Declaration Has No Output
102-
Variable declaration statements are not expressions! They don't return any value and can't be used inside of other expressions. Therefore, they don't print anything to the output.
103-
:::
87+
You can read more detail about built-in functions on the [Functions Guide](/v3/functions/guide) page.

docs/versions/v3/language-elements/literals.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ You can use string literals and concatenate them with other strings. You can use
2020
{{ "Hello" + 'World!' }}
2121
```
2222

23-
> When you print a string, it will be automatically escaped. If you want to print a string without escaping it, you can use the [raw()](/v3/functions/str#raw) function on strings. Example: <code v-pre>{{ "<h1>Test</h1>".raw() }}</code>
23+
When you print a string, it will be automatically escaped. If you want to print a string without escaping it, you can use the [raw()](/v3/functions/str#raw) function on strings. Example:
24+
25+
```textwire :no-line-numbers
26+
{{ "<h1>Test</h1>".raw() }}
27+
```
2428

2529
## Integer
2630
You can use integer literals and perform arithmetic operations with them. Here is an example of using integer literals:

docs/versions/v3/language-elements/other.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ description: Learn about trailing commas and comments in Textwire, including how
77

88
- [Trailing commas](#trailing-commas) <code v-pre>{{ [1, 2, 3,] }}</code>
99
- [Comments](#comments) <code v-pre>{{-- This is a Textwire comment --}}</code>
10+
- [Variable Declaration](#variable-declaration) <code v-pre>{{ x = 5 }}</code>
1011

1112
## Trailing Commas
1213

@@ -34,3 +35,18 @@ You can use comments in Textwire to write notes or to comment out code. Here is
3435
```
3536

3637
HTML comment will be displayed in the final HTML output, but Textwire comment will be removed from the final HTML output. It might be useful when you want to comment out some code that you don't want to be displayed in the final HTML output.
38+
39+
## Variable Declaration
40+
41+
You can assign and declare variables by using the `=` operator. Here is an example of declaring variables:
42+
43+
```textwire :no-line-numbers
44+
{{ x = 5 }}
45+
{{ x = 10 }}
46+
```
47+
48+
You cannot assign values to variables of a different type. For example, you cannot do <code v-pre>{{ x = "Hello"; x = 3 }}</code> because `x` is a string and then you are trying to assign an integer to it. In Textwire, you don't need to declare type of a variable, it will be automatically inferred from the value that you assign to it.
49+
50+
:::tip Declaration Has No Output
51+
Variable declaration statements are not expressions! They don't return any value and can't be used inside of other expressions. Therefore, they don't print anything to the output.
52+
:::

0 commit comments

Comments
 (0)