summaryrefslogtreecommitdiffstats
path: root/docs/templating
diff options
context:
space:
mode:
Diffstat (limited to 'docs/templating')
-rw-r--r--docs/templating/README.md19
-rw-r--r--docs/templating/conrefs.md6
-rw-r--r--docs/templating/variables.md8
3 files changed, 16 insertions, 17 deletions
diff --git a/docs/templating/README.md b/docs/templating/README.md
index 38df38e..963f921 100644
--- a/docs/templating/README.md
+++ b/docs/templating/README.md
@@ -1,18 +1,18 @@
# Templating
-GitBook uses the Nunjucks templating language to process pages and theme's templates.
+GitBook uses the [Nunjucks templating language](https://mozilla.github.io/nunjucks/) to process pages and theme's templates.
-The Nunjucks syntax is very similar to **Jinja2** or **Liquid**.
+The Nunjucks syntax is very similar to **Jinja2** or **Liquid**. Its syntax uses surrounding braces `{ }` to mark content that needs to be processed.
### Variables
-A variable looks up a value from the template context. If you wanted to simply display a variable, you would do:
+A variable looks up a value from the template context. If you wanted to simply display a variable, you would use the `{{ variable }}` syntax. For example :
```twig
-{{ username }}
+My name is {{ name }}, nice to meet you
```
-This looks up username from the context and displays it. Variable names can have dots in them which lookup properties, just like javascript. You can also use the square bracket syntax.
+This looks up username from the context and displays it. Variable names can have dots in them which lookup properties, just like JavaScript. You can also use the square bracket syntax.
```twig
{{ foo.bar }}
@@ -21,7 +21,7 @@ This looks up username from the context and displays it. Variable names can have
If a value is undefined, nothing is displayed. The following all output nothing if foo is undefined: `{{ foo }}`, `{{ foo.bar }}`, `{{ foo.bar.baz }}`.
-GitBook provides a set of [context variables](variables.md).
+GitBook provides a set of [predefined variables](variables.md) from the context.
### Filters
@@ -39,7 +39,7 @@ The third example shows how you can chain filters. It would display "Bar", by fi
##### if
-`if` tests a condition and lets you selectively display content. It behaves exactly as javascript's if behaves.
+`if` tests a condition and lets you selectively display content. It behaves exactly as JavaScript's `if` behaves.
```twig
{% if variable %}
@@ -49,7 +49,7 @@ The third example shows how you can chain filters. It would display "Bar", by fi
If variable is defined and evaluates to true, "It is true" will be displayed. Otherwise, nothing will be.
-You can specify alternate conditions with elif and else:
+You can specify alternate conditions with `elif` and `else`:
```twig
{% if hungry %}
@@ -86,5 +86,4 @@ Current version is {{ softwareVersion }}.
##### include and block
-Inclusion and inheritance is detailled in the [ConRefs](conrefs.md) section.
-
+Inclusion and inheritance is detailled in the [Content References](conrefs.md) section.
diff --git a/docs/templating/conrefs.md b/docs/templating/conrefs.md
index 4eb6e0b..252fec9 100644
--- a/docs/templating/conrefs.md
+++ b/docs/templating/conrefs.md
@@ -1,10 +1,10 @@
# Content References
-Content referencing (conref) is a convenient mechanism for reuse of content from other files or books.
+Content referencing (conref) is a convenient mechanism to reuse content from other files or books.
### Importing local files
-Importing an other file's content is really easy using the `include` tag:
+Importing an other file's content is easy using the `include` tag:
```
{% include "./test.md" %}
@@ -42,7 +42,7 @@ Template inheritance is a way to make it easy to reuse templates. When writing a
{% endblock %}
```
-In the file `mypage.md`, you should specify the blocks that can be extent:
+In the file `mypage.md`, you should specify the blocks that can be extended:
```
{% block pageContent %}
diff --git a/docs/templating/variables.md b/docs/templating/variables.md
index 3dbd6f7..bca5880 100644
--- a/docs/templating/variables.md
+++ b/docs/templating/variables.md
@@ -6,7 +6,7 @@ The following is a reference of the available data during book's parsing and the
| Variable | Description |
| -------- | ----------- |
-| `book` | Bookwide information + configuration settings from `book.json`. See below for details. |
+| `book` | Book-wide information + configuration settings from `book.json`. See below for details. |
| `gitbook` | GitBook specific information |
| `page` | Current page specific information |
| `file` | File associated with the current page specific information |
@@ -25,7 +25,7 @@ The following is a reference of the available data during book's parsing and the
| Variable | Description |
| -------- | ----------- |
-| `gitbook.time` | The current time (when you run the `gitbook` command). |
+| `gitbook.time` | The current time (when you run the `gitbook` command) . |
| `gitbook.version` | Version of GitBook used to generate the book |
### File Variables
@@ -33,7 +33,7 @@ The following is a reference of the available data during book's parsing and the
| Variable | Description |
| -------- | ----------- |
| `file.path` | The path to the raw page |
-| `file.mtime` | Modified Time, Time when file data last modified |
+| `file.mtime` | Modified Time. Last time the file was modified |
| `file.type` | The name of the parser used to compile this file (ex: `markdown`, `asciidoc`, etc) |
#### Page Variables
@@ -51,7 +51,7 @@ The following is a reference of the available data during book's parsing and the
| -------- | ----------- |
| `summary.parts` | List of sections in the Table of Contents |
-Thw whole table of contents (`SUMMARY.md`) can be accessed:
+The whole table of contents (`SUMMARY.md`) can be accessed:
`summary.parts[0].articles[0].title` will return the title of the first article.