Skip to content

Commit

Permalink
docs: add Twig's built-in tests, filters, functions and tags
Browse files Browse the repository at this point in the history
Signed-off-by: tbreuss <[email protected]>
  • Loading branch information
tbreuss committed Dec 25, 2022
1 parent 3f634c6 commit 8c68415
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 1 deletion.
55 changes: 55 additions & 0 deletions website/site/data/twig_filters_builtin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
- name: abs
- name: batch
- name: capitalize
- name: column
- name: convert_encoding
- name: country_name
- name: currency_name
- name: currency_symbol
- name: data_uri
- name: date
- name: date_modify
- name: default
- name: escape
- name: filter
- name: first
- name: format
- name: format_currency
- name: format_date
- name: format_datetime
- name: format_number
- name: format_time
- name: html_to_markdown
- name: inline_css
- name: inky_to_html
- name: join
- name: json_encode
- name: keys
- name: language_name
- name: last
- name: length
- name: locale_name
- name: lower
- name: map
- name: markdown_to_html
- name: merge
- name: nl2br
- name: number_format
- name: raw
- name: reduce
- name: replace
- name: reverse
- name: round
- name: slice
- name: slug
- name: sort
- name: spaceless
- name: split
- name: striptags
- name: timezone_name
- name: title
- name: trim
- name: u
- name: upper
- name: url_encode
17 changes: 17 additions & 0 deletions website/site/data/twig_functions_builtin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: attribute
- name: block
- name: constant
- name: cycle
- name: date
- name: dump
- name: html_classes
- name: include
- name: max
- name: min
- name: parent
- name: random
- name: range
- name: source
- name: country_timezones
- name: template_from_string
21 changes: 21 additions & 0 deletions website/site/data/twig_tags_builtin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
- name: apply
- name: autoescape
- name: block
- name: cache
- name: deprecated
- name: do
- name: embed
- name: extends
- name: flush
- name: for
- name: from
- name: if
- name: import
- name: include
- name: macro
- name: sandbox
- name: set
- name: use
- name: verbatim
- name: with
12 changes: 12 additions & 0 deletions website/site/data/twig_tests_builtin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- name: constant
- name: defined
- name: divisible by
slug: divisibleby
- name: empty
- name: even
- name: iterable
- name: 'null'
- name: odd
- name: same as
slug: sameas
13 changes: 12 additions & 1 deletion website/site/pages/2-doc/5-indepth/5-twig-filters.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ layout: doc
# Twig Filters

Herbie is using [Twig Filters](https://twig.symfony.com/doc/3.x/filters/index.html) for modifying variables in layout and content files.
In addition to the built-in filters of Twig itself, the following filters are available.
The following filters are available.

{{ snippet("@site/snippets/twig_features.twig", {type:"twig_filters"}) }}

## Built-in Filters

In addition to the filters mentioned above, Twig's built-in filters are of course also available.
Please note that some of the filters may require the installation of additional Composer packages.

<ul>
{% for filter in site.data.twig_filters_builtin %}
<li><a href="https://twig.symfony.com/doc/3.x/filters/{{ filter.name }}.html" target="_blank">{{ filter.name }}</a></li>
{% endfor %}
</ul>
11 changes: 11 additions & 0 deletions website/site/pages/2-doc/5-indepth/6-twig-functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@ Herbie is using [Twig Functions](https://twig.symfony.com/doc/3.x/functions/inde
In addition to the built-in functions of Twig itself, the following functions are available.

{{ snippet("@site/snippets/twig_features.twig", {type:"twig_functions"}) }}

## Built-in Functions

In addition to the functions mentioned above, Twig's built-in functions are of course also available.
Please note that some of the functions may require the installation of additional Composer packages.

<ul>
{% for function in site.data.twig_functions_builtin %}
<li><a href="https://twig.symfony.com/doc/3.x/functions/{{ function.name }}.html" target="_blank">{{ function.name }}</a></li>
{% endfor %}
</ul>
15 changes: 15 additions & 0 deletions website/site/pages/2-doc/5-indepth/8-twig-tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
title: Twig Tags
layout: doc
---

# Twig Tags

Herbie does not provide its own Twig tags, but the tags provided by Twig are of course available.
Please note that some of the tags may require the installation of additional Composer packages.

<ul>
{% for tag in site.data.twig_tags_builtin %}
<li><a href="https://twig.symfony.com/doc/3.x/tags/{{ tag.name }}.html" target="_blank">{{ tag.name }}</a></li>
{% endfor %}
</ul>
11 changes: 11 additions & 0 deletions website/site/pages/2-doc/5-indepth/8-twig-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,14 @@ Herbie is using [Twig Tests](https://twig.symfony.com/doc/3.x/tests/index.html)
In addition to the built-in tests of Twig, the following tests are available.

{{ snippet("@site/snippets/twig_features.twig", {type:"twig_tests"}) }}

## Built-in Tests

In addition to the tests mentioned above, Twig's built-in tests are of course also available.
Please note that some of the tests may require the installation of additional Composer packages.

<ul>
{% for test in site.data.twig_tests_builtin %}
<li><a href="https://twig.symfony.com/doc/3.x/tests/{{ test.slug ?: test.name }}.html" target="_blank">{{ test.name }}</a></li>
{% endfor %}
</ul>

0 comments on commit 8c68415

Please sign in to comment.