mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
docs_ci: check all md files except thirdparty (#6855)
This commit is contained in:
@@ -18,7 +18,7 @@ There's also the V forum: https://github.com/vlang/vorum
|
||||
|
||||
`vorum.v` contains all GET and POST actions.
|
||||
|
||||
```Go
|
||||
```v ignore
|
||||
pub fn (app mut App) index() {
|
||||
posts := app.find_all_posts()
|
||||
$vweb.html()
|
||||
@@ -52,7 +52,8 @@ pub fn (app App) post() {
|
||||
@end
|
||||
```
|
||||
|
||||
`$vweb.html()` compiles an HTML template into V during compilation, and embeds the resulting code in current action.
|
||||
`$vweb.html()` compiles an HTML template into V during compilation,
|
||||
and embeds the resulting code in current action.
|
||||
|
||||
That means that the template automatically has access to that action's entire environment.
|
||||
|
||||
@@ -60,4 +61,3 @@ That means that the template automatically has access to that action's entire en
|
||||
### Deploying vweb apps
|
||||
|
||||
Everything, including HTML templates, is in one binary file. That's all you need to deploy.
|
||||
|
||||
|
@@ -2,9 +2,11 @@ This package is to generate data-driven HTML output.
|
||||
|
||||
# Directives
|
||||
Each directive begins with an `@` sign.
|
||||
Some directives begin contains a `{}` block, others only have `''` (string) parameters. More on the directives itself.
|
||||
Some directives begin contains a `{}` block, others only have `''` (string) parameters.
|
||||
More on the directives itself.
|
||||
|
||||
Newlines on the beginning and end are ignored in `{}` blocks, otherwise this (see [if](##if) for this syntax):
|
||||
Newlines on the beginning and end are ignored in `{}` blocks,
|
||||
otherwise this (see [if](##if) for this syntax):
|
||||
```html
|
||||
@if bool_val {
|
||||
<span>This is shown if bool_val is true</span>
|
||||
@@ -19,7 +21,8 @@ would result in:
|
||||
which could result in unreadable output.
|
||||
|
||||
## if
|
||||
The if directive consists of three parts, the `@if` tag, the condition (same syntax like in V) and the `{}` block where you can write html which will be rendered if the condition is true:
|
||||
The if directive consists of three parts, the `@if` tag, the condition (same syntax like in V)
|
||||
and the `{}` block where you can write html which will be rendered if the condition is true:
|
||||
```
|
||||
@if <condition> {}
|
||||
```
|
||||
@@ -45,7 +48,8 @@ while the one-liner results in:
|
||||
```
|
||||
|
||||
## for
|
||||
The for directive consists of three parts, the `@for` tag, the condition (same syntax like in V) and the `{}` block where you can write html which will be rendered for each loop:
|
||||
The for directive consists of three parts, the `@for` tag, the condition (same syntax like in V)
|
||||
and the `{}` block where you can write html which will be rendered for each loop:
|
||||
```
|
||||
@for <condition> {}
|
||||
```
|
||||
@@ -84,7 +88,8 @@ You can also write (and all other for condition syntaxes that are allowed in V):
|
||||
```
|
||||
|
||||
## include
|
||||
The include directive is for including other html files (which will be processed as well) and consists of two parts, the `@include` tag and a following `'<path>'` string.
|
||||
The include directive is for including other html files (which will be processed as well)
|
||||
and consists of two parts, the `@include` tag and a following `'<path>'` string.
|
||||
The path parameter is relative to the `/templates` directory in the corresponding project.
|
||||
|
||||
### Example
|
||||
@@ -101,7 +106,9 @@ Project root
|
||||
```html
|
||||
<div>@include 'header/base'</div>
|
||||
```
|
||||
> Note that there shouldn't be a file suffix, it is automatically appended and only allows `html` files.
|
||||
> Note that there shouldn't be a file suffix,
|
||||
it is automatically appended and only allows `html` files.
|
||||
|
||||
# Variables
|
||||
All variables which are declared before can be used through the `@{my_var}` syntax. It's also possible to use properties of structs here like `@{my_struct.prop}`.
|
||||
All variables which are declared before can be used through the `@{my_var}` syntax.
|
||||
It's also possible to use properties of structs here like `@{my_struct.prop}`.
|
||||
|
Reference in New Issue
Block a user