Skip to content

Commit e76f090

Browse files
committed
Update docs
1 parent 3df0873 commit e76f090

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+493
-304
lines changed

_config.yml

-16
This file was deleted.

CNAME renamed to docs/CNAME

File renamed without changes.

docs/_config.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
title: "Aspect Lua Template"
2+
description: "Aspect is a compiling template engine for Lua and LuaJIT."
3+
encoding: UTF-8
4+
markdown: kramdown
5+
url: "https://aspect.unifire.app"
6+
exclude:
7+
- src
8+
- bin
9+
remote_theme: bzick/jekyll-docs-theme
10+
google_analytics: UA-164241665-1
11+
12+
# theme configuration
13+
14+
project:
15+
download_url: https://github.com/unifire-app/aspect/releases
16+
download_text: Download
17+
18+
license:
19+
software: BSD 3 Clause
20+
software_url: https://opensource.org/licenses/BSD-3-Clause
21+
22+
docs: CC BY 3.0
23+
docs_url: https://creativecommons.org/licenses/by/3.0/
24+
25+
links:
26+
pages:
27+
- title: Syntax
28+
url: /syntax
29+
- title: Tags
30+
url: /tags
31+
- title: Filters
32+
url: /filters
33+
- title: Funcs
34+
url: /funcs
35+
- title: Tests
36+
url: /tests
37+
- title: API
38+
url: /api
39+
- title: CLI
40+
url: /cli
41+
header:
42+
- title: '<img src="https://travis-ci.org/unifire-app/aspect.svg?branch=master" />'
43+
url: https://travis-ci.org/unifire-app/aspect
44+
- title: '<img src="https://codecov.io/gh/unifire-app/aspect/branch/master/graph/badge.svg" />'
45+
url: https://codecov.io/gh/unifire-app/aspect
46+
- title: '<img src="/assets/luarocks.svg" />'
47+
url: https://luarocks.org/modules/unifire/aspect
48+
footer:
49+
- title: GitHub
50+
icon: github
51+
brand: true
52+
url: https://github.com/unifire-app/pages
53+
- title: Issues
54+
icon: bug
55+
url: https://github.com/unifire-app/pages/issues?state=open
56+
homepage:
57+
- title: View on GitHub
58+
icon: github
59+
brand: true
60+
url: https://github.com/unifire-app/pages
61+
62+
icons:
63+
favicon: aspect.png

docs/api.md

+4-65
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,14 @@
1-
[Aspect](./../readme.md) › API Documentation
2-
============================================
1+
---
2+
layout: page
3+
title: API Documentation
4+
---
35

46
<!-- {% raw %} -->
57

68
This chapter describes the API to Aspect and not the template language.
79
It will be most useful as reference to those implementing the template interface to the application
810
and not those who are creating Aspect templates.
911

10-
Table Of Content
11-
----------------
12-
13-
- [Basic API Usage](#basic-api-usage)
14-
- [Rendering Templates](#rendering-templates)
15-
- [Options](#options)
16-
- [Cache](#cache)
17-
- [Loaders](#loaders)
18-
- [Extending](#extending)
19-
- [Add tags](#add-tags)
20-
- [Add filters](#add-filters)
21-
- [Add functions](#add-functions)
22-
- [Add operators](#add-operators)
23-
- [Behaviors](#behaviors)
24-
- [Condition behaviour](#condition-behaviour)
25-
- [Empty string behaviour](#empty-string-behaviour)
26-
- [Number behaviour](#number-behaviour)
27-
- [Custom escaper](#custom-escaper)
28-
- [Date processing](#date-processing)
29-
- [Iterator and countable objects](#iterator-and-countable-objects)
30-
3112
Basic API Usage
3213
--------------
3314

@@ -58,8 +39,6 @@ aspect:display("dashboard.tpl", {
5839
})
5940
```
6041

61-
[Back to TOC](#table-of-content)
62-
6342
## Render result
6443

6544
```lua
@@ -76,8 +55,6 @@ local output, err = aspect:display(template, vars)
7655
```
7756
- `err` is `aspect.error` object and contains error information. `nil` if no errors.
7857

79-
[Back to TOC](#table-of-content)
80-
8158
Rendering Templates
8259
-------------------
8360

@@ -111,8 +88,6 @@ Rendering Templates
11188
**Note**. `render` functions and `display` functions returns `aspect.output` object with template result
11289
(if result not displayed) and more useful information
11390

114-
[Back to TOC](#table-of-content)
115-
11691
Options
11792
-------
11893

@@ -142,8 +117,6 @@ The following options are available:
142117
* `autoescape` _boolean_
143118
Enables or disables auto-escaping with 'html' strategy.
144119

145-
[Back to TOC](#table-of-content)
146-
147120
Cache
148121
-----
149122

@@ -198,8 +171,6 @@ local template = aspect.new({
198171
})
199172
```
200173

201-
[Back to TOC](#table-of-content)
202-
203174
Loaders
204175
-------
205176

@@ -219,8 +190,6 @@ aspect:display("pages/about.html", vars)
219190

220191
loads `/var/project/templates/pages/about.html` template.
221192

222-
[Back to TOC](#table-of-content)
223-
224193
### Resty loader
225194

226195
```lua
@@ -235,8 +204,6 @@ aspect:display("pages/about.html", vars)
235204

236205
loads `/.templates/pages/about.html` template (via [ngx.location.capture](https://github.com/openresty/lua-nginx-module#ngxlocationcapture)).
237206

238-
[Back to TOC](#table-of-content)
239-
240207
### Array loader
241208

242209
```lua
@@ -248,8 +215,6 @@ tpls["theme.tpl"] = [[<html> ... template ... </html>]]
248215
aspect.loader = tpls
249216
```
250217

251-
[Back to TOC](#table-of-content)
252-
253218
Extending
254219
---------
255220

@@ -295,8 +260,6 @@ end
295260

296261
See [aspect.tags](../src/aspect/tags.lua) for more examples.
297262

298-
[Back to TOC](#table-of-content)
299-
300263
## Add filters
301264

302265
```lua
@@ -317,8 +280,6 @@ end)
317280

318281
See [aspect.filters](../src/aspect/filters.lua) for more examples.
319282

320-
[Back to TOC](#table-of-content)
321-
322283
## Add functions
323284

324285
Add function `{{ foo(arg1=x, arg2=y) }}`:
@@ -346,8 +307,6 @@ end)
346307

347308
See [aspect.funcs](../src/aspect/funcs.lua) for more examples.
348309

349-
[Back to TOC](#table-of-content)
350-
351310
## Add tests
352311

353312
Add tests `foo`, `bar` and `baz`
@@ -378,8 +337,6 @@ Result:
378337

379338
See [aspect.tests](../src/aspect/tests.lua) for more examples.
380339

381-
[Back to TOC](#table-of-content)
382-
383340
## Add operators
384341

385342
For example add bitwise operator `&` (using [bitop](http://bitop.luajit.org/) package):
@@ -406,8 +363,6 @@ table.insert(ops, {
406363

407364
See [aspect.ast.ops](../src/aspect/ast/ops.lua) for more examples.
408365

409-
[Back to TOC](#table-of-content)
410-
411366
## Behaviors
412367

413368
### Condition behaviour
@@ -456,8 +411,6 @@ is_false['0'] = true
456411

457412
Now example output `Unacceptable condition!` because `zero` will be casted to false.
458413

459-
[Back to TOC](#table-of-content)
460-
461414
### Empty string behaviour
462415

463416
Configure `aspect.config.is_empty_string` table. Indicate which values ​​are empty string or values ​​with specific metatable.
@@ -468,8 +421,6 @@ is_empty_string[ngx.null] = true
468421
is_empty_string[getmetatable(cbson.null())] = true
469422
```
470423

471-
[Back to TOC](#table-of-content)
472-
473424
### Number behaviour
474425

475426
Configure `aspect.config.is_n` table. Indicate which objects can behave like numbers.
@@ -479,8 +430,6 @@ local is_n = require("aspect.config").is_n
479430
is_n[getmetatable(cbson.number(0))] = 0
480431
```
481432

482-
[Back to TOC](#table-of-content)
483-
484433
## Custom escaper
485434

486435
Add custom escaper via config, using escaper name:
@@ -495,8 +444,6 @@ end
495444
{{ data.raw|e("csv") }}
496445
```
497446

498-
[Back to TOC](#table-of-content)
499-
500447
## Date processing
501448

502449
### strtotime
@@ -508,8 +455,6 @@ local strtotime = require("aspect.utils.date").strtotime
508455
local ts, info = strtotime("2009-02-13 23:31:30")
509456
```
510457

511-
[Back to TOC](#table-of-content)
512-
513458
### Date localization
514459

515460
Add or change month localizations. For example add localized months for russian and spain languages.
@@ -524,8 +469,6 @@ months["diciembre"] = 12 -- add long name of december on spain
524469
```
525470
There 1 - january, 12 - december.
526471

527-
[Back to TOC](#table-of-content)
528-
529472
### Date parser
530473

531474
Add or change date parsers. For example add parser for date like `2009Y02M13D23h31m30s+0230z` (it is `2009-02-13 23:31:30 UTC+02:30`)
@@ -570,8 +513,6 @@ How parsers work:
570513

571514
See `date.parsers` for more information.
572515

573-
[Back to TOC](#table-of-content)
574-
575516
Iterator and countable objects
576517
-------------------------------
577518

@@ -583,6 +524,4 @@ For example see [range iterator](../src/aspect/utils/range.lua).
583524
As in Lua 5.2+, the Aspect allows to determine the length of objects through the `__len()` function.
584525
Works for all lua/luajit versions.
585526

586-
[Back to TOC](#table-of-content)
587-
588527
<!-- {% endraw %} -->
File renamed without changes.
File renamed without changes.

docs/features.md renamed to docs/behaviors.md

+4-23
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,7 @@
1-
[Aspect](./../readme.md) › Features
2-
========
3-
4-
<!-- {% raw %} -->
5-
6-
* Sandboxed execution mode. Every aspect of the template execution is monitored and explicitly whitelisted or blacklisted,
7-
whatever is preferred. This makes it possible to execute untrusted templates.
8-
* Powerful [automatic HTML escaping](./syntax.md#escape-control) system for cross site scripting prevention.
9-
* [Template inheritance](./syntax.md#template-inheritance) makes it possible to use the same or a similar layout for all templates.
10-
* High performance with just in time compilation to Lua bytecode.
11-
Aspect will translate your template sources on first load into Lua bytecode for best runtime performance.
12-
* Easy to debug with a debug system that integrates template compile and runtime errors into the standard Lua traceback system.
13-
* [Configurable syntax](./api.md#extending).
14-
* [Iterator supported](./api.md#iterator) and countable objects.
15-
* Supports lua 5.1/5.2/5.3 and luajit 2.0/2.1 (including OpenResty)
16-
* Keys sequence `a.b.c.d` returns `nil` if variable `a` or any keys doesn't exits.
17-
* [Two level cache](./api.md#cache) (lua level and bytecode level).
18-
* Date support.
19-
* [Chain rendering](./api.md#rendering-templates) (renders data chunk by chunk).
20-
* Change some Lua behaviours (see below).
21-
22-
Behaviours
23-
==========
1+
---
2+
layout: page
3+
title: Behaviors
4+
---
245

256
## Working with strings
267

docs/cli.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
[Aspect](./../readme.md) › Command Line
2-
===================
1+
---
2+
layout: page
3+
title: Command Line
4+
---
35

46
<!-- {% raw %} -->
57

docs/filters.md

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
[Aspect](./../readme.md) › Filters
2-
===============================
1+
---
2+
layout: page
3+
title: Filters
4+
---
35

46
<!-- {% raw %} -->
57

@@ -8,23 +10,23 @@
810
* [column(column)](./filters/columns.md)
911
* [date(format)](./filters/date.md)
1012
* [date_modify(offset)](./filters/date_modify.md)
11-
* [escape(type), e(type)](./filters/escape.md)
1213
* [default(value, boolean)](./filters/default.md)
14+
* [escape(type), e(type)](./filters/escape.md)
1315
* [first](./filters/first.md)
14-
* [last](./filters/last.md)
1516
* [format(...)](./filters/format.md)
1617
* [join(delim, last_delim)](./filters/join.md)
1718
* [json_encode](./filters/json_encode.md)
1819
* [keys](./filters/keys.md)
20+
* [last](./filters/last.md)
1921
* [length](./filters/length.md)
2022
* [lower](./filters/lower.md)
21-
* [upper](./filters/lower.md)
2223
* [merge(items)](./filters/merge.md)
2324
* [nl2br](./filters/nl2br.md)
2425
* [raw](./filters/raw.md)
2526
* [replace()](./filters/replace.md)
2627
* [split(delimiter, limit)](./filters/split.md)
2728
* [striptags](./filters/striptags.md)
2829
* [trim](./filters/trim.md)
30+
* [upper](./filters/lower.md)
2931

3032
<!-- {% endraw %} -->

docs/filters/abs.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
1-
[Aspect](./../../readme.md)[Filters](./../filters.md) › abs
2-
==========
1+
---
2+
layout: page
3+
title: Filters › abs
4+
---
5+
6+
[← filters](./../filters.md)
37

48
<!-- {% raw %} -->
59

0 commit comments

Comments
 (0)