Skip to content

Commit 8cea34b

Browse files
committed
Docfix
1 parent cda0664 commit 8cea34b

File tree

3 files changed

+46
-14
lines changed

3 files changed

+46
-14
lines changed

docs/api.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -712,7 +712,7 @@ Add or change month and day of the week localizations.
712712

713713
**Month localization**
714714

715-
For parser (required utf8 module)
715+
For parser ([required utf8 module](#configure-utf8))
716716
```lua
717717
local months = require("aspect.config").date.months
718718
months["дек"] = 12 -- add short name of december on russian
@@ -721,7 +721,7 @@ months["dic"] = 12 -- add short name of december on spain
721721
months["diciembre"] = 12 -- add long name of december on spain
722722
-- ...
723723
```
724-
For formatter
724+
For formatter (utf8 module NOT required)
725725
```lua
726726
local months_locale = require("aspect.config").date.months_locale
727727
months_locale["ru"] = { -- add Russian name of month
@@ -731,11 +731,11 @@ months_locale["ru"] = { -- add Russian name of month
731731
--- ...
732732
}
733733
```
734-
There 1 - january, 12 - december. Index 1 — short name of month, index 2 - normal name of month.
734+
There 1 - january, 12 - december. Index 1 — short name of month, index 2 - full name of month.
735735

736736
**Week localization**
737737

738-
For formatter
738+
For formatter (utf8 module NOT required)
739739
```lua
740740
local week_locale = require("aspect.config").date.week_locale
741741
week_locale["ru"] = { -- add Russian day of the week
@@ -791,6 +791,15 @@ How parsers work:
791791

792792
See `date.parsers` for more information.
793793

794+
### Date format aliases
795+
796+
Add symbol `R` (`%R`) witch is `%I:%M:%S %p`
797+
798+
```lua
799+
local aliases = require("aspect.config").date.aliases
800+
aliases["R"] = "%I:%M:%S %p"
801+
```
802+
794803
Iterator and countable objects
795804
-------------------------------
796805

docs/filters/date.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ Time must be supplied if date is not given, vice versa.
2626
If the 24-hour clock is used, it is an error to specify "PM" for times later than 12 noon.
2727
For example, "23:15 PM" is an error.
2828

29-
**Time Zone Format.** First character is a sign "+" (east of UTC) or "-" (west of UTC).
30-
Hours and minutes offset are separated by colons.
31-
Another format is `[sign][number]`. If `[number]` is less than 24, it is the offset in hours e.g. "-10" = -10 hours.
32-
Otherwise it is the offset in houndred hours e.g. "+75" = "+115" = +1.25 hours.
29+
**Time Zone Format.** First character is a sign "+" (to the east) or "-" (to the west).
30+
Hours and minutes in the UTC offset can be separated by a colon.
31+
Another format is `[sign][number]`. If `[number]` is less than 24, it is the offset in hours e.g. "-10" = -10 hours.
3332

3433
**Supported Format.**
3534

36-
* `YYYY-MM-DD`, `MM/DD/YYYY`, `MMMM DD YYYY`, `DD MMMM YYYY` — where YYYY is the year, MM is the month of the year, MMMM is the month full name or abbr, and DD is the day of the month ("2000-12-31", "20001231").
35+
* `YYYY-MM-DD`, `MM/DD/YYYY`, `MMMM DD YYYY`, `DD MMMM YYYY` — where YYYY is the year, MM is the month of the year,
36+
MMMM is the month full name or abbr, and DD is the day of the month.
3737
* `DATE HH:MM:SS` — Where DATE is the date format discuss above, HH is the hour,
38-
MM is the miute, SS is the seconds ("1995-02-04 24:00:51", "1976-W01-1 12:12:12.123").
38+
MM is the miute, SS is the seconds.
3939
* `DATE TIME +HH:MM`, `DATE TIME -HHMM`, `DATE TIME UTC`
4040

4141
[Add your date formats](./../api.md#date-parser).
@@ -90,8 +90,9 @@ The `format` string follows the same rules as the `strftime` standard C function
9090
| `%n` | A newline character (`\n`) | |
9191
| `%t` | A Tab character (`\t`) | |
9292

93+
9394
**Aliases**:
94-
95+
9596
| Spec | Description | Format | Example |
9697
|------|-------------|--------|---------|
9798
| `$c` | Preferred date | `%a %b %d %H:%m%s %Y` | `Tue Jun 23 15:45:01 2020` |
@@ -101,5 +102,6 @@ The `format` string follows the same rules as the `strftime` standard C function
101102
| `$D` | month/day/year from 01/01/00 | `%m/%d/%y` | `12/02/79` |
102103
| `$F` | year-month-day | `%Y-%m-%d` | `1979-12-02` |
103104

104-
[Add more aliases](./dev/date.md#aliases)
105+
106+
[Add more aliases](./../api.md#date-format-aliases)
105107
<!-- {% endraw %} -->

docs/syntax.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,11 +331,32 @@ Arrays and hashes can be nested:
331331

332332
#### Logic operators
333333

334-
* `and`: Returns true if the left and the right operands are both true.
335-
* `or`: Returns true if the left or the right operand is true.
334+
* `and`: Returns 'true' value if the left and the right operands are both 'true' value.
335+
* `or`: Returns 'true' value if the left or the right operand is 'true' value.
336336
* `not`: Negates a statement.
337337
* `(expr)`: Groups an expression.
338338

339+
Like control structures, all logical operators consider `false`, `nil` and other [false-values](./spec.md#working-with-booleans)
340+
as false and anything else as true.
341+
The operator `and` returns its first argument if it is false; otherwise, it returns its second argument.
342+
The operator `or` returns its first argument if it is not false; otherwise, it returns its second argument:
343+
344+
```twig
345+
{{ 4 and 5 }} --> 5
346+
{{ nil and 13 }} --> nil --> empty string
347+
{{ false and 13 }} --> false --> empty string
348+
{{ 4 or 5 }} --> 4
349+
{{ false or 5 }} --> 5
350+
```
351+
352+
Useful for default values:
353+
354+
```twig
355+
{{ form.text(x or y) }}
356+
```
357+
358+
it pass to the macro a default value `v` when `x` is not set (provided that `x` is not set to false).
359+
339360
#### Comparisons operators
340361

341362
The following comparison operators are supported in any expression: `==`, `!=`, `<`, `>`, `>=`, and `<=`.

0 commit comments

Comments
 (0)