diff --git a/README.md b/README.md index 668c7cd..290ccce 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Stencil -[![Build Status](https://travis-ci.org/kylef/Stencil.svg?branch=master)](https://travis-ci.org/kylef/Stencil) +[![Build Status](https://travis-ci.org/stencilproject/Stencil.svg?branch=master)](https://travis-ci.org/stencilproject/Stencil) Stencil is a simple and powerful template language for Swift. It provides a syntax similar to Django and Mustache. If you're familiar with these, you will diff --git a/Stencil.podspec.json b/Stencil.podspec.json index 5980553..a173c05 100644 --- a/Stencil.podspec.json +++ b/Stencil.podspec.json @@ -12,7 +12,7 @@ }, "social_media_url": "https://twitter.com/kylefuller", "source": { - "git": "https://github.com/kylef/Stencil.git", + "git": "https://github.com/stencilproject/Stencil.git", "tag": "0.11.0" }, "source_files": [ diff --git a/docs/builtins.rst b/docs/builtins.rst index c1f46ad..9d61eca 100644 --- a/docs/builtins.rst +++ b/docs/builtins.rst @@ -28,6 +28,18 @@ The ``for`` tag can iterate over dictionaries.
  • {{ key }}: {{ value }}
  • {% endfor %} + +It can also iterate over ranges, tuple elements, structs' and classes' stored properties (using ``Mirror``). + +You can iterate over range literals created using ``N...M`` syntax, both in ascending and descending order: + +.. code-block:: html+django + + The ``for`` tag can contain optional ``where`` expression to filter out elements on which this expression evaluates to false. @@ -59,6 +71,7 @@ The for block sets a few variables available within the loop: - ``last`` - True if this is the last time through the loop - ``counter`` - The current iteration of the loop (1 indexed) - ``counter0`` - The current iteration of the loop (0 indexed) +- ``length`` - The total length of the loop For example: @@ -281,7 +294,7 @@ Built-in Filters ~~~~~~~~~~~~~~ The capitalize filter allows you to capitalize a string. -For example, `stencil` to `Stencil`. +For example, `stencil` to `Stencil`. Can be applied to array of strings to change each string. .. code-block:: html+django @@ -291,7 +304,7 @@ For example, `stencil` to `Stencil`. ~~~~~~~~~~~~~ The uppercase filter allows you to transform a string to uppercase. -For example, `Stencil` to `STENCIL`. +For example, `Stencil` to `STENCIL`. Can be applied to array of strings to change each string. .. code-block:: html+django @@ -301,7 +314,7 @@ For example, `Stencil` to `STENCIL`. ~~~~~~~~~~~~~ The uppercase filter allows you to transform a string to lowercase. -For example, `Stencil` to `stencil`. +For example, `Stencil` to `stencil`. Can be applied to array of strings to change each string. .. code-block:: html+django @@ -326,4 +339,31 @@ Join an array of items. {{ value|join:", " }} -.. note:: The value MUST be an array. +.. note:: The value MUST be an array. Default argument value is empty string. + +``split`` +~~~~~~~~~ + +Split string into substrings by separator. + +.. code-block:: html+django + + {{ value|split:", " }} + +.. note:: The value MUST be a String. Default argument value is a single-space string. + +``indent`` +~~~~~~~~~ + +Indents lines of rendered value or block. + +.. code-block:: html+django + + {{ value|indent:2," ",true }} + +Filter accepts several arguments: + +* indentation width: number of indentation characters to indent lines with. Default is ``4``. +* indentation character: character to be used for indentation. Default is a space. +* indent first line: whether first line of output should be indented or not. Default is ``false``. +