Add russian docs

This commit is contained in:
bzick
2014-08-01 12:12:19 +04:00
parent 00eaafc39f
commit 5972884c80
48 changed files with 2127 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
Modifier date_format
====================
This formats a date and time into the given [strftime()](http://docs.php.net/strftime) format.
Dates can be passed to Fenom as unix timestamps, DateTime objects or any string made up of month day year, parsable by [strftime()](http://docs.php.net/strftime).
By default format is: `%b %e, %Y`.
```smarty
{var $ts = time()}
{$ts|date_format:"%Y/%m/%d %H:%M:%s"} outputs 2013/02/08 21:01:43
{$ts|date_format:"-1 day"} outputs 2013/02/07 21:01:43
{var $date = "2008-12-08"}
{$ts|date_format:"%Y/%m/%d %H:%M:%s"} outputs 2008/12/08 00:00:00
```
[Allowed quantificators](http://docs.php.net/strftime#refsect1-function.strftime-parameters) in **date_format**

18
docs/ru/mods/ematch.md Normal file
View File

@@ -0,0 +1,18 @@
Modifier ematch
==============
Perform a regular expression match.
[Read more](http://www.php.net/manual/en/reference.pcre.pattern.syntax.php) about regular expression.
```
{$string|ematch:$pattern}
```
Searches `$string` for a match to the regular expression given in `$pattern`.
```smarty
{if $color|ematch:'/^gr[ae]y$/i'}
some form of gray ...
{/if}
```

23
docs/ru/mods/ereplace.md Normal file
View File

@@ -0,0 +1,23 @@
Modifier ereplace
=================
Perform a regular expression search and replace.
[Read more](http://www.php.net/manual/en/reference.pcre.pattern.syntax.php) about regular expression.
```
{$string|replace:$pattern:$replacement}
```
Searches `$string` for matches to `$pattern` and replaces them with `$replacement`.
`$replacement` may contain references of the form `\n`, `$n` or `${n}`, with the latter form being the preferred one.
Every such reference will be replaced by the text captured by the n'th parenthesized pattern. n can be from 0 to 99,
and `\0` or `$0` refers to the text matched by the whole pattern.
Opening parentheses are counted from left to right (starting from 1) to obtain the number of the capturing subpattern.
To use backslash in replacement, it must be doubled.
```smarty
{var $string = 'April 15, 2014'}
{$string|ereplace:'/(\w+) (\d+), (\d+)/i':'${1}1, $3'} {* April1, 2014 *}
```

20
docs/ru/mods/escape.md Normal file
View File

@@ -0,0 +1,20 @@
Modifier escape
===============
The modifier escapes a string for safe insertion into the output.
It supports different escaping strategies depending on the template context.
By default, it uses the HTML escaping strategy:
```smarty
{$post.title|escape:'html'}
```
The modifier supports the following escaping strategies:
* html: escapes a string for the HTML body context.
* url: escapes a string for the URI or parameter contexts.
* js: escapes a string for the JavaScript context.
For convenience, the `e` modifier is defined as an alias of `escape` modifier.
Second parameter is charset.

19
docs/ru/mods/esplit.md Normal file
View File

@@ -0,0 +1,19 @@
Modifier esplit
===============
Split string by a regular expression.
[Read more](http://www.php.net/manual/en/reference.pcre.pattern.syntax.php) about regular expression.
```
{$string|esplit:$pattern = '/,\s*/'}
```
My default modifier split string by comma with spaces.
```smarty
{var $fruits1 = "banana, apple, pear"|esplit}
$fruits1 is array ["banana", "apple", "pear"]
{var $fruits2 = "banana; apple; pear"|esplit:'/;\s/'} is ["banana", "apple", "pear"]
$fruits2 is array ["banana", "apple", "pear"] too
```

10
docs/ru/mods/in.md Normal file
View File

@@ -0,0 +1,10 @@
Modifier in
===========
The modifier is implementation of [in](../operators.md#containment-operator) operator (performs containment test).
```smarty
{if $number|in:[1, 3, 42]}
...
{/if}
```

16
docs/ru/mods/join.md Normal file
View File

@@ -0,0 +1,16 @@
Modifier split
==============
Join array elements with a string.
```
{$string|join:$delimiter = ","}
```
Returns an array of strings, each of which is a substring of `$string` formed by splitting it on boundaries formed by the string `$delimiter`.
```smarty
{var $fruits1 = ["banana", "apple", "pear"]}
{$fruits1|join} output banana, apple, pear
{$fruits1|join:" is not "} output banana is not apple is not pear
```

10
docs/ru/mods/length.md Normal file
View File

@@ -0,0 +1,10 @@
Modifier length
===============
The modifier returns the number of items of a sequence or mapping, or the length of a string (works with UTF8 without `mbstring`)
```smarty
{if $images|length > 5}
to many images
{/if}
```

13
docs/ru/mods/lower.md Normal file
View File

@@ -0,0 +1,13 @@
Modifier lower
==============
Modifier is used to lowercase a variable or string. Have short alias `low`
This is equivalent to the PHP [strtolower()](http://docs.php.net/lower) function.
```smarty
{var $name = "Bzick"}
{$name} output Bzick
{$name|upper} output bzick
{$name|up} output bzick too
```

24
docs/ru/mods/match.md Normal file
View File

@@ -0,0 +1,24 @@
Modifier match
==============
Match string against a pattern.
The average user may be used to shell patterns or at least in their simplest form to `?` and `*` wildcards so using `match`
instead of `ematch` for frontend search expression input may be way more convenient for non-programming users.
```
{$string|match:$pattern}
```
Special pattern symbols:
* `?` — match one or zero unknown characters. `?at` matches `Cat`, `cat`, `Bat` or `bat`, `but` not `at`.
* `*` — match any number of unknown characters. `Law*` matches `Law`, `Laws`, or `Lawyer`.
* `[characters]` — Match a character as part of a group of characters. `[CB]at` matches `Cat` or `Bat` but not `cat`, `rat` or `bat`.
* `\` - Escape character. `Law\*` will only match `Law*`
```smarty
{if $color|match:"*gr[ae]y"}
some form of gray ...
{/if}
```

14
docs/ru/mods/replace.md Normal file
View File

@@ -0,0 +1,14 @@
Modifier replace
================
Replace all occurrences of the search string with the replacement string
```
{$string|replace:$search:$replace}
```
This modifier returns a string with all occurrences of `$search` in subject replaced with the given `$replace` value.
```smarty
{$fruits|replace:"pear":"orange"}
```

18
docs/ru/mods/split.md Normal file
View File

@@ -0,0 +1,18 @@
Modifier split
==============
Split a string by string
```
{$string|split:$delimiter = ","}
```
Returns an array of strings, each of which is a substring of `$string` formed by splitting it on boundaries formed by the string `$delimiter`.
```smarty
{var $fruits1 = "banana,apple,pear"|split}
$fruits1 is array ["banana", "apple", "pear"]
{var $fruits2 = "banana,apple,pear"|split:',apple,'}
$fruits2 is array ["banana", "pear"]
```

16
docs/ru/mods/strip.md Normal file
View File

@@ -0,0 +1,16 @@
Modifier strip
==============
This replaces all repeated spaces and tabs with a single space, or with the supplied string.
```smarty
{" one two "|strip} => 'one two'
```
Optional boolean parameter tell to the modifier strip also newline
```smarty
{" multi
line
text "|strip:true} => 'multi line text'
```

22
docs/ru/mods/truncate.md Normal file
View File

@@ -0,0 +1,22 @@
Modifier truncate
=================
Modifier truncates a variable to a character length.
```smarty
{$long_string|truncate:$length:$etc:$by_words:$middle}
```
* `$length`, required. Parameter determines how many characters to truncate to.
* `$etc`, by default `...`. This is a text string that replaces the truncated text.
* `$by_word`, by default **FALSE**. This determines whether or not to truncate at a word boundary with TRUE, or at the exact character with FALSE.
* `$middle`, by default **FALSE**. This determines whether the truncation happens at the end of the string with FALSE, or in the middle of the string with TRUE.
```smarty
{var $str = "very very long string"}
{$str|truncate:10:" read more..."} output: very very read more...
{$str|truncate:5:" ... ":true:true} output: very ... string
```
Modifier do not use `mbstring` when works with UTF8.

5
docs/ru/mods/unescape.md Normal file
View File

@@ -0,0 +1,5 @@
Modifier unescape
=================
`Unescape` is used to decode entity, html, js and URI. See [escape](./escape.md)

13
docs/ru/mods/upper.md Normal file
View File

@@ -0,0 +1,13 @@
Modifier upper
==============
Modifier is used to uppercase a variable or string. Have short alias `up`.
This is equivalent to the PHP [strtoupper()](http://docs.php.net/strtoupper) function.
```smarty
{var $name = "Bzick"}
{$name} outputs Bzick
{$name|upper} outputs BZICK
{$name|up} outputs BZICK too
```