diff options
author | Samy Pesse <samypesse@gmail.com> | 2016-02-29 21:50:48 +0100 |
---|---|---|
committer | Samy Pesse <samypesse@gmail.com> | 2016-02-29 21:50:48 +0100 |
commit | c08e5ce62c30cb8d014151448bfe6da6b5a47fcf (patch) | |
tree | fd9504c00d46786aebe2c65c6a95fa62edb363a7 /docs/templating/variables.md | |
parent | ec353e179dedf1ebf1ab6e54f6217a88d087ea75 (diff) | |
download | gitbook-c08e5ce62c30cb8d014151448bfe6da6b5a47fcf.zip gitbook-c08e5ce62c30cb8d014151448bfe6da6b5a47fcf.tar.gz gitbook-c08e5ce62c30cb8d014151448bfe6da6b5a47fcf.tar.bz2 |
Improve structure of doc
Diffstat (limited to 'docs/templating/variables.md')
-rw-r--r-- | docs/templating/variables.md | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/docs/templating/variables.md b/docs/templating/variables.md new file mode 100644 index 0000000..3dbd6f7 --- /dev/null +++ b/docs/templating/variables.md @@ -0,0 +1,64 @@ +# Variables + +The following is a reference of the available data during book's parsing and theme generation. + +### Global Variables + +| Variable | Description | +| -------- | ----------- | +| `book` | Bookwide 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 | +| `summary` | Information about the table of contents | +| `languages` | List of languages for multi-lingual books | +| `config` | Dump of the `book.json` | + +### Book Variables + +| Variable | Description | +| -------- | ----------- | +| `book.[CONFIGURATION_DATA]` | All the `variables` set via the `book.json` are available through the book variable. | +| `book.language` | Current language for a multilingual book | + +### GitBook Variables + +| Variable | Description | +| -------- | ----------- | +| `gitbook.time` | The current time (when you run the `gitbook` command). | +| `gitbook.version` | Version of GitBook used to generate the book | + +### File Variables + +| Variable | Description | +| -------- | ----------- | +| `file.path` | The path to the raw page | +| `file.mtime` | Modified Time, Time when file data last modified | +| `file.type` | The name of the parser used to compile this file (ex: `markdown`, `asciidoc`, etc) | + +#### Page Variables + +| Variable | Description | +| -------- | ----------- | +| `page.title` | Title of the page | +| `page.previous` | Previous page in the Table of Contents (can be `null`) | +| `page.next` | Next page in the Table of Contents (can be `null`) | +| `page.dir` | Text direction, based on configuration or detected from content (`rtl` or `ltr`) | + +#### Table of Contents Variables + +| Variable | Description | +| -------- | ----------- | +| `summary.parts` | List of sections in the Table of Contents | + +Thw whole table of contents (`SUMMARY.md`) can be accessed: + +`summary.parts[0].articles[0].title` will return the title of the first article. + +#### Multi-lingual book Variable + +| Variable | Description | +| -------- | ----------- | +| `languages.list` | List of languages for this book | + +Languages are defined by `{ id: 'en', title: 'English' }`. |