diff -Nru php-twig-2.14.1/CHANGELOG php-twig-2.14.3/CHANGELOG --- php-twig-2.14.1/CHANGELOG 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/CHANGELOG 2021-01-07 21:35:24.000000000 +0000 @@ -1,3 +1,11 @@ +# 2.14.3 (2021-01-05) + + * Fix extra bundle compat with older versions of Symfony + +# 2.14.2 (2021-01-05) + + * Fix "odd" not working for negative numbers + # 2.14.1 (2020-10-27) * Fix "include(template_from_string())" @@ -328,7 +336,15 @@ * improved the performance of the filesystem loader * removed features that were deprecated in 1.x -# 1.44.1 (2020-XX-XX) +# 1.44.3 (2021-XX-XX) + + * n/a + +# 1.44.2 (2021-01-05) + + * Fix "odd" not working for negative numbers + +# 1.44.1 (2020-10-27) * Fix "include(template_from_string())" diff -Nru php-twig-2.14.1/debian/changelog php-twig-2.14.3/debian/changelog --- php-twig-2.14.1/debian/changelog 2020-12-20 21:00:47.000000000 +0000 +++ php-twig-2.14.3/debian/changelog 2021-01-07 22:41:35.000000000 +0000 @@ -1,3 +1,19 @@ +php-twig (2.14.3-1) unstable; urgency=medium + + [ Fabien Potencier ] + * Bump copyright year + * Move things around + * Prepare the 2.14.3 release + + [ David Prévot ] + * Update copyright + * Adapt to new upstream distribution path + * Don’t rely on string not installed in Bullseye + * Use LC_ALL=en_US for intl tests + * Install /u/s/p/autoloaders file + + -- David Prévot Thu, 07 Jan 2021 18:41:35 -0400 + php-twig (2.14.1-2) unstable; urgency=medium * Adapt to recent version of PHPUnit (9) diff -Nru php-twig-2.14.1/debian/clean php-twig-2.14.3/debian/clean --- php-twig-2.14.1/debian/clean 2020-11-21 20:05:54.000000000 +0000 +++ php-twig-2.14.3/debian/clean 2021-01-07 22:41:35.000000000 +0000 @@ -1,7 +1,8 @@ .phpunit.result.cache +debian/autoloaders/ debian/build-tmp/ debian/packages_to_build/ -extra/*/src/autoload.php +extra/*/autoload.php src/autoload.php src/psr-0/ src/Extra/ diff -Nru php-twig-2.14.1/debian/copyright php-twig-2.14.3/debian/copyright --- php-twig-2.14.1/debian/copyright 2020-12-20 20:59:40.000000000 +0000 +++ php-twig-2.14.3/debian/copyright 2021-01-07 22:41:35.000000000 +0000 @@ -4,7 +4,7 @@ Source: https://github.com/twigphp/Twig Files: * -Copyright: 2009-2020 Twig Team +Copyright: 2009-2021 Twig Team 2019 Fabien Potencier Armin Ronacher License: BSD-3-clause @@ -15,7 +15,11 @@ 2005-2012 Zend Technologies USA Inc. License: BSD-3-clause and BSD-3-clause-Zend -Files: extra/html-extra/tests/Fixtures/data_uri.test +Files: extra/* +Copyright: 2019-2021 Fabien Potencier +License: Expat + +Files: extra/html-extra/Tests/Fixtures/data_uri.test Copyright: 2004-2019 Fabien Potencier License: BSD-3-clause and CC-BY-SA-3.0 Comment: Icon created by SensioLabs are shared under CC-BY-SA-3.0. diff -Nru php-twig-2.14.1/debian/patches/0001-Don-t-rely-on-string-not-installed-in-Bullseye.patch php-twig-2.14.3/debian/patches/0001-Don-t-rely-on-string-not-installed-in-Bullseye.patch --- php-twig-2.14.1/debian/patches/0001-Don-t-rely-on-string-not-installed-in-Bullseye.patch 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/debian/patches/0001-Don-t-rely-on-string-not-installed-in-Bullseye.patch 2021-01-07 22:41:35.000000000 +0000 @@ -0,0 +1,21 @@ +From: =?utf-8?q?David_Pr=C3=A9vot?= +Date: Thu, 7 Jan 2021 18:40:09 -0400 +Subject: =?utf-8?q?Don=E2=80=99t_rely_on_string_not_installed_in_Bullseye?= + +Forwarded: not-needed +--- + .../Tests/DependencyInjection/TwigExtraExtensionTest.php | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/extra/twig-extra-bundle/Tests/DependencyInjection/TwigExtraExtensionTest.php b/extra/twig-extra-bundle/Tests/DependencyInjection/TwigExtraExtensionTest.php +index 852162d..1872c6e 100644 +--- a/extra/twig-extra-bundle/Tests/DependencyInjection/TwigExtraExtensionTest.php ++++ b/extra/twig-extra-bundle/Tests/DependencyInjection/TwigExtraExtensionTest.php +@@ -32,6 +32,7 @@ class TwigExtraExtensionTest extends TestCase + $container->compile(); + + foreach (Extensions::getClasses() as $name => $class) { ++ if ($name != 'string') + $this->assertEquals($class, $container->getDefinition('twig.extension.'.$name)->getClass()); + } + } diff -Nru php-twig-2.14.1/debian/patches/series php-twig-2.14.3/debian/patches/series --- php-twig-2.14.1/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/debian/patches/series 2021-01-07 22:41:35.000000000 +0000 @@ -0,0 +1 @@ +0001-Don-t-rely-on-string-not-installed-in-Bullseye.patch diff -Nru php-twig-2.14.1/debian/rules php-twig-2.14.3/debian/rules --- php-twig-2.14.1/debian/rules 2020-11-21 20:05:54.000000000 +0000 +++ php-twig-2.14.3/debian/rules 2021-01-07 22:41:35.000000000 +0000 @@ -26,19 +26,19 @@ mkdir --parents vendor src/Extra phpab --output vendor/autoload.php \ --template debian/autoload.tests.php.tpl \ - tests extra/*/tests + tests extra/*/Tests # Mimic install path ln -s src Twig - ln -s ../../extra/cssinliner-extra/src Twig/Extra/CssInliner - ln -s ../../extra/html-extra/src Twig/Extra/Html - ln -s ../../extra/inky-extra/src Twig/Extra/Inky - ln -s ../../extra/intl-extra/src Twig/Extra/Intl - ln -s ../../extra/markdown-extra/src Twig/Extra/Markdown - # ln -s ../../extra/string-extra/src Twig/Extra/String - ln -s ../../extra/twig-extra-bundle/src Twig/Extra/TwigExtraBundle + ln -s ../../extra/cssinliner-extra Twig/Extra/CssInliner + ln -s ../../extra/html-extra Twig/Extra/Html + ln -s ../../extra/inky-extra Twig/Extra/Inky + ln -s ../../extra/intl-extra Twig/Extra/Intl + ln -s ../../extra/markdown-extra Twig/Extra/Markdown + # ln -s ../../extra/string-extra Twig/Extra/String + ln -s ../../extra/twig-extra-bundle Twig/Extra/TwigExtraBundle # php-twig extra # Parts from the symfony package’s debian/rules. - mkdir --parents debian/packages_to_build + mkdir --parents debian/packages_to_build debian/autoloaders # Walk through the parts of upstream's code that should be packaged into # separate Debian binary packages and write down a package-to-build info # file containing shell variables for each package. @@ -49,8 +49,8 @@ # debian/$deb_pkg_name.autoload.php.tpl if it exists (to load dependencies). set -e;\ for src_path in $$(find -L Twig/Extra/ -mindepth 1 -maxdepth 1 -type d); do \ - if [ -e $$src_path/../composer.json ]; then \ - deb_pkg_name=php-$$(cat $$src_path/../composer.json | jq -r '.name | tostring' | sed -r 's|/|-|'); \ + if [ -e $$src_path/composer.json ]; then \ + deb_pkg_name=php-$$(cat $$src_path/composer.json | jq -r '.name | tostring' | sed -r 's|/|-|'); \ if [ $$(grep -c -E -e "^Package: $$deb_pkg_name\$$" debian/control) -ne 1 ]; then \ echo "W: No Debian package '$$deb_pkg_name' defined in debian/control," 1>&2; \ echo " therefor not considering Symfony $$src_path," 1>&2; \ @@ -60,13 +60,16 @@ echo "# by various targets in debian/rules" >> debian/packages_to_build/$$deb_pkg_name; \ echo "deb_pkg_name='$$deb_pkg_name'" >> debian/packages_to_build/$$deb_pkg_name; \ echo "src_path='$$src_path'" >> debian/packages_to_build/$$deb_pkg_name; \ + echo "twig $${deb_pkg_name#php-twig-} $$src_path/autoload.php" > debian/autoloaders/$$deb_pkg_name; \ if [ -e debian/$$deb_pkg_name.autoload.php.tpl ]; then \ phpab \ + --blacklist '*\\tests\\*' \ --output $$src_path/autoload.php \ --template debian/$$deb_pkg_name.autoload.php.tpl \ $$src_path; \ else \ phpab \ + --blacklist '*\\tests\\*' \ --output $$src_path/autoload.php \ $$src_path; \ fi; \ @@ -79,8 +82,8 @@ set -e; \ for package_info_file in $$(find debian/packages_to_build/ -mindepth 1 -maxdepth 1 -type f); do \ . $$package_info_file; \ - if [ -f $$src_path/../phpunit.xml.dist -a $$src_path != Twig/Extra/Intl ]; then \ - phpunit $$src_path/..; \ + if [ -f $$src_path/phpunit.xml.dist ]; then \ + LC_ALL=en_US phpunit $$src_path; \ fi; \ done @@ -93,7 +96,14 @@ set -e; \ for package_info_file in $$(find debian/packages_to_build/ -mindepth 1 -maxdepth 1 -type f); do \ . $$package_info_file; \ + dh_install --package=$$deb_pkg_name \ + debian/autoloaders/$$deb_pkg_name usr/share/pkg-php-tools/autoloaders; \ dh_install \ + -X.md \ + -Xcomposer.json \ + -XLICENSE \ + -Xphpunit.xml.dist \ + -XTests \ --package=$$deb_pkg_name \ $$src_path/* \ usr/share/php/$$src_path/; \ @@ -108,5 +118,5 @@ set -e;\ for package_info_file in $$(find debian/packages_to_build/ -mindepth 1 -maxdepth 1 -type f); do \ . $$package_info_file; \ - dh_phpcomposer --package=$$deb_pkg_name --sourcedirectory=$$src_path/..; \ + dh_phpcomposer --package=$$deb_pkg_name --sourcedirectory=$$src_path; \ done diff -Nru php-twig-2.14.1/debian/tests/control php-twig-2.14.3/debian/tests/control --- php-twig-2.14.1/debian/tests/control 2020-12-20 21:00:22.000000000 +0000 +++ php-twig-2.14.3/debian/tests/control 2021-01-07 22:41:35.000000000 +0000 @@ -1,4 +1,4 @@ -Test-Command: mkdir -p vendor && phpab -o vendor/autoload.php -t debian/autoload.tests.php.tpl tests && phpunit && for i in extra/*/; do if [ $i != extra/intl-extra/ -a $i != extra/string-extra/ ]; then phpunit $i; fi; done +Test-Command: mkdir -p vendor && phpab -o vendor/autoload.php -t debian/autoload.tests.php.tpl tests && phpunit && for i in extra/*/; do if [ $i != extra/string-extra/ ]; then LC_ALL=en_US phpunit $i; fi; done Depends: locales-all, php-league-commonmark, php-league-html-to-markdown, diff -Nru php-twig-2.14.1/doc/advanced.rst php-twig-2.14.3/doc/advanced.rst --- php-twig-2.14.1/doc/advanced.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/advanced.rst 2021-01-07 21:35:24.000000000 +0000 @@ -346,7 +346,7 @@ $compiler ->raw('(') ->subcompile($this->getNode('node')) - ->raw(' % 2 == 1') + ->raw(' % 2 != 0') ->raw(')') ; } @@ -365,6 +365,7 @@ various other arguments that have been provided to your test. .. versionadded:: 2.6 + Dynamic tests support was added in Twig 2.6. If you want to pass a variable number of positional or named arguments to the @@ -913,6 +914,5 @@ ``\Twig\Test\NodeTestCase``. Examples can be found in the Twig repository `tests/Twig/Node`_ directory. -.. _`rot13`: https://secure.php.net/manual/en/function.str-rot13.php .. _`tests/Twig/Fixtures`: https://github.com/twigphp/Twig/tree/2.x/tests/Fixtures .. _`tests/Twig/Node`: https://github.com/twigphp/Twig/tree/2.x/tests/Node diff -Nru php-twig-2.14.1/doc/api.rst php-twig-2.14.3/doc/api.rst --- php-twig-2.14.1/doc/api.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/api.rst 2021-01-07 21:35:24.000000000 +0000 @@ -321,12 +321,12 @@ * *Twig\Extension\SandboxExtension*: Adds a sandbox mode to the default Twig environment, making it safe to evaluate untrusted code. -* *Twig\Extension\ProfilerExtension*: Enabled the built-in Twig profiler. +* *Twig\Extension\ProfilerExtension*: Enables the built-in Twig profiler. * *Twig\Extension\OptimizerExtension*: Optimizes the node tree before compilation. -* *Twig\Extension\StringLoaderExtension*: Defined the ``template_from_string`` +* *Twig\Extension\StringLoaderExtension*: Defines the ``template_from_string`` function to allow loading templates from string in a template. The Core, Escaper, and Optimizer extensions are registered by default. @@ -389,26 +389,26 @@ * Literals (integers, booleans, arrays, ...) used in the template directly as variables or filter arguments are never automatically escaped: - .. code-block:: twig + .. code-block:: html+twig - {{ "Twig
" }} {# won't be escaped #} + {{ "Twig
" }} {# won't be escaped #} - {% set text = "Twig
" %} + {% set text = "Twig
" %} {{ text }} {# will be escaped #} * Expressions which the result is a literal or a variable marked safe are never automatically escaped: - .. code-block:: twig + .. code-block:: html+twig - {{ foo ? "Twig
" : "
Twig" }} {# won't be escaped #} + {{ foo ? "Twig
" : "
Twig" }} {# won't be escaped #} - {% set text = "Twig
" %} - {{ true ? text : "
Twig" }} {# will be escaped #} - {{ false ? text : "
Twig" }} {# won't be escaped #} + {% set text = "Twig
" %} + {{ true ? text : "
Twig" }} {# will be escaped #} + {{ false ? text : "
Twig" }} {# won't be escaped #} - {% set text = "Twig
" %} - {{ foo ? text|raw : "
Twig" }} {# won't be escaped #} + {% set text = "Twig
" %} + {{ foo ? text|raw : "
Twig" }} {# won't be escaped #} * Objects with a ``__toString`` method are converted to strings and escaped. You can mark some classes and/or interfaces as being safe for some diff -Nru php-twig-2.14.1/doc/_build/conf.py php-twig-2.14.3/doc/_build/conf.py --- php-twig-2.14.1/doc/_build/conf.py 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/doc/_build/conf.py 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,271 @@ +# -*- coding: utf-8 -*- +# +# Symfony documentation build configuration file, created by +# sphinx-quickstart on Sat Jul 28 21:58:57 2012. +# +# This file is execfile()d with the current directory set to its containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +import sys, os + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +#sys.path.append(os.path.abspath('_exts')) + +# adding PhpLexer +from sphinx.highlighting import lexers +from pygments.lexers.special import TextLexer +from pygments.lexers.text import RstLexer +from pygments.lexers.web import PhpLexer + +# -- General configuration ----------------------------------------------------- + +# If your documentation needs a minimal Sphinx version, state it here. +needs_sphinx = '1.8.5' + +# Add any Sphinx extension module names here, as strings. They can be extensions +# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. +extensions = [ + 'sphinx.ext.autodoc', 'sphinx.ext.doctest', + 'sphinx.ext.todo', 'sphinx.ext.coverage', 'sphinx.ext.ifconfig', + 'sphinx.ext.viewcode', 'sphinx.ext.extlinks', + 'sensio.sphinx.codeblock', 'sensio.sphinx.configurationblock', 'sensio.sphinx.phpcode', 'sensio.sphinx.bestpractice' +] + +#spelling_show_sugestions=True +#spelling_lang='en_US' +#spelling_word_list_filename='_build/spelling_word_list.txt' + +# Add any paths that contain templates here, relative to this directory. +# templates_path = ['_theme/_templates'] + +# The suffix of source filenames. +source_suffix = '.rst' + +# The encoding of source files. +#source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'Twig' +copyright = '' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +# version = '2.2' +# The full version, including alpha/beta/rc tags. +# release = '2.2.13' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +#language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +#today = '' +# Else, today_fmt is used as the format for a strftime call. +#today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +exclude_patterns = ['_build'] + +# The reST default role (used for this markup: `text`) to use for all documents. +#default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +#add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +#add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +#show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +#pygments_style = 'symfonycom.sphinx.SensioStyle' + +# A list of ignored prefixes for module index sorting. +#modindex_common_prefix = [] + +# -- Settings for symfony doc extension --------------------------------------------------- + +# enable highlighting for PHP code not between ```` by default +lexers['php'] = PhpLexer(startinline=True) +lexers['rst'] = RstLexer() + +config_block = { + 'rst': 'reStructuredText', +} + +# don't enable Sphinx Domains +primary_domain = None + +# set url for API links +#api_url = 'https://github.com/symfony/symfony/blob/master/src/%s.php' + + +# -- Options for HTML output --------------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +html_theme = "sphinx_rtd_theme" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +html_theme_options = { + 'logo_only': True, + 'prev_next_buttons_location': None, + 'style_nav_header_background': '#f0f0f0' +} + +# Add any paths that contain custom themes here, relative to this directory. +#html_theme_path = [] + +# The name for this set of Sphinx documents. If None, it defaults to +# " v documentation". +#html_title = None + +# A shorter title for the navigation bar. Default is the same as html_title. +#html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +#html_logo = '_static/symfony-logo.svg' + +# The name of an image file (within the static path) to use as favicon of the +# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +#html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +#html_static_path = ['_static'] +#html_css_files = ['rtd_custom.css'] + +# If not '', a 'Last updated on:' timestamp is inserted at every page bottom, +# using the given strftime format. +#html_last_updated_fmt = '%b %d, %Y' + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +#html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +#html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +#html_additional_pages = {} + +# If false, no module index is generated. +#html_domain_indices = True + +# If false, no index is generated. +#html_use_index = True + +# If true, the index is split into individual pages for each letter. +#html_split_index = False + +# If true, links to the reST sources are added to the pages. +#html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +#html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +#html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +#html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +#html_file_suffix = None + +# Output file base name for HTML help builder. +htmlhelp_basename = 'Twig' + + +# -- Options for LaTeX output -------------------------------------------------- + +latex_elements = { +# The paper size ('letterpaper' or 'a4paper'). +#'papersize': 'letterpaper', + +# The font size ('10pt', '11pt' or '12pt'). +#'pointsize': '10pt', + +# Additional stuff for the LaTeX preamble. +#'preamble': '', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, author, documentclass [howto/manual]). +#latex_documents = [] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +#latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +#latex_use_parts = False + +# If true, show page references after internal links. +#latex_show_pagerefs = False + +# If true, show URL addresses after external links. +#latex_show_urls = False + +# Documents to append as an appendix to all manuals. +#latex_appendices = [] + +# If false, no module index is generated. +#latex_domain_indices = True + + +# -- Options for manual page output -------------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +#man_pages = [] + +# If true, show URL addresses after external links. +#man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------------ + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +#texinfo_documents = [] + +# Documents to append as an appendix to all manuals. +#texinfo_appendices = [] + +# If false, no module index is generated. +#texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +#texinfo_show_urls = 'footnote' + +# Use PHP syntax highlighting in code examples by default +highlight_language='php' diff -Nru php-twig-2.14.1/doc/_build/Makefile php-twig-2.14.3/doc/_build/Makefile --- php-twig-2.14.1/doc/_build/Makefile 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/doc/_build/Makefile 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,153 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = . + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -c $(BUILDDIR) -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) ../ +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext + +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " dirhtml to make HTML files named index.html in directories" + @echo " singlehtml to make a single large HTML file" + @echo " pickle to make pickle files" + @echo " json to make JSON files" + @echo " htmlhelp to make HTML files and a HTML help project" + @echo " qthelp to make HTML files and a qthelp project" + @echo " devhelp to make HTML files and a Devhelp project" + @echo " epub to make an epub" + @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" + @echo " latexpdf to make LaTeX files and run them through pdflatex" + @echo " text to make text files" + @echo " man to make manual pages" + @echo " texinfo to make Texinfo files" + @echo " info to make Texinfo files and run them through makeinfo" + @echo " gettext to make PO message catalogs" + @echo " changes to make an overview of all changed/added/deprecated items" + @echo " linkcheck to check all external links for integrity" + @echo " doctest to run all doctests embedded in the documentation (if enabled)" + +clean: + -rm -rf $(BUILDDIR)/* + +html: + $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +dirhtml: + $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml + @echo + @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +singlehtml: + $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml + @echo + @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +pickle: + $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle + @echo + @echo "Build finished; now you can process the pickle files." + +json: + $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json + @echo + @echo "Build finished; now you can process the JSON files." + +htmlhelp: + $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp + @echo + @echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +qthelp: + $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp + @echo + @echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" + @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Symfony.qhcp" + @echo "To view the help file:" + @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Symfony.qhc" + +devhelp: + $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp + @echo + @echo "Build finished." + @echo "To view the help file:" + @echo "# mkdir -p $$HOME/.local/share/devhelp/Symfony" + @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Symfony" + @echo "# devhelp" + +epub: + $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +latex: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo + @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." + @echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +latexpdf: + $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex + @echo "Running LaTeX files through pdflatex..." + $(MAKE) -C $(BUILDDIR)/latex all-pdf + @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +text: + $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text + @echo + @echo "Build finished. The text files are in $(BUILDDIR)/text." + +man: + $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man + @echo + @echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +texinfo: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo + @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." + @echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +info: + $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo + @echo "Running Texinfo files through makeinfo..." + make -C $(BUILDDIR)/texinfo info + @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +gettext: + $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale + @echo + @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +changes: + $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes + @echo + @echo "The overview file is in $(BUILDDIR)/changes." + +linkcheck: + $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck + @echo + @echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +doctest: + $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest + @echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." diff -Nru php-twig-2.14.1/doc/_build/.requirements.txt php-twig-2.14.3/doc/_build/.requirements.txt --- php-twig-2.14.1/doc/_build/.requirements.txt 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/doc/_build/.requirements.txt 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,6 @@ +docutils==0.13.1 +Pygments==2.2.0 +sphinx==1.8.5 +git+https://github.com/fabpot/sphinx-php.git@v2.0.0#egg_name=sphinx-php +jsx-lexer===0.0.8 +sphinx_rtd_theme==0.5.0 diff -Nru php-twig-2.14.1/doc/.doctor-rst.yaml php-twig-2.14.3/doc/.doctor-rst.yaml --- php-twig-2.14.1/doc/.doctor-rst.yaml 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/doc/.doctor-rst.yaml 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,54 @@ +rules: + american_english: ~ + avoid_repetetive_words: ~ + blank_line_after_directive: ~ + blank_line_before_directive: ~ + composer_dev_option_not_at_the_end: ~ + correct_code_block_directive_based_on_the_content: ~ + deprecated_directive_should_have_version: ~ + ensure_order_of_code_blocks_in_configuration_block: ~ + extension_xlf_instead_of_xliff: ~ + indention: ~ + lowercase_as_in_use_statements: ~ + max_blank_lines: + max: 2 + no_blank_line_after_filepath_in_php_code_block: ~ + no_blank_line_after_filepath_in_twig_code_block: ~ + no_blank_line_after_filepath_in_xml_code_block: ~ + no_blank_line_after_filepath_in_yaml_code_block: ~ + no_composer_req: ~ + no_explicit_use_of_code_block_php: ~ + no_inheritdoc: ~ + no_namespace_after_use_statements: ~ + no_php_open_tag_in_code_block_php_directive: ~ + no_space_before_self_xml_closing_tag: ~ + ordered_use_statements: ~ + php_prefix_before_bin_console: ~ + replace_code_block_types: ~ + replacement: ~ + short_array_syntax: ~ + typo: ~ + unused_links: ~ + use_deprecated_directive_instead_of_versionadded: ~ + use_https_xsd_urls: ~ + valid_inline_highlighted_namespaces: ~ + valid_use_statements: ~ + versionadded_directive_should_have_version: ~ + yaml_instead_of_yml_suffix: ~ + yarn_dev_option_at_the_end: ~ + + versionadded_directive_major_version: + major_version: 2 + + versionadded_directive_min_version: + min_version: '2.0' + + deprecated_directive_major_version: + major_version: 2 + + deprecated_directive_min_version: + min_version: '2.0' + +whitelist: + lines: + - 'I like Twig.
' diff -Nru php-twig-2.14.1/doc/filters/batch.rst php-twig-2.14.3/doc/filters/batch.rst --- php-twig-2.14.1/doc/filters/batch.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/batch.rst 2021-01-07 21:35:24.000000000 +0000 @@ -5,7 +5,7 @@ given number of items. A second parameter can be provided and used to fill in missing items: -.. code-block:: twig +.. code-block:: html+twig {% set items = ['a', 'b', 'c', 'd'] %} @@ -21,7 +21,7 @@ The above example will be rendered as: -.. code-block:: twig +.. code-block:: html+twig diff -Nru php-twig-2.14.1/doc/filters/column.rst php-twig-2.14.3/doc/filters/column.rst --- php-twig-2.14.1/doc/filters/column.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/column.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ========== .. versionadded:: 2.8 + The ``column`` filter was added in Twig 2.8. The ``column`` filter returns the values from a single column in the input diff -Nru php-twig-2.14.1/doc/filters/country_name.rst php-twig-2.14.3/doc/filters/country_name.rst --- php-twig-2.14.1/doc/filters/country_name.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/country_name.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ================ .. versionadded:: 2.12 + The ``country_name`` filter was added in Twig 2.12. The ``country_name`` filter returns the country name given its ISO-3166 @@ -26,7 +27,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/currency_name.rst php-twig-2.14.3/doc/filters/currency_name.rst --- php-twig-2.14.1/doc/filters/currency_name.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/currency_name.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ================= .. versionadded:: 2.12 + The ``currency_name`` filter was added in Twig 2.12. The ``currency_name`` filter returns the currency name given its three-letter @@ -29,7 +30,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/currency_symbol.rst php-twig-2.14.3/doc/filters/currency_symbol.rst --- php-twig-2.14.1/doc/filters/currency_symbol.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/currency_symbol.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ =================== .. versionadded:: 2.12 + The ``currency_symbol`` filter was added in Twig 2.12. The ``currency_symbol`` filter returns the currency symbol given its three-letter @@ -29,7 +30,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/data_uri.rst php-twig-2.14.3/doc/filters/data_uri.rst --- php-twig-2.14.1/doc/filters/data_uri.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/data_uri.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,12 +2,13 @@ ============ .. versionadded:: 2.12 + The ``data_uri`` filter was added in Twig 2.12. The ``data_uri`` filter generates a URL using the data scheme as defined in RFC 2397: -.. code-block:: twig +.. code-block:: html+twig {{ image_data|data_uri }} @@ -29,7 +30,7 @@ .. code-block:: bash - $ composer req twig/html-extra + $ composer require twig/html-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/date.rst php-twig-2.14.3/doc/filters/date.rst --- php-twig-2.14.1/doc/filters/date.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/date.rst 2021-01-07 21:35:24.000000000 +0000 @@ -37,9 +37,7 @@ If no format is provided, Twig will use the default one: ``F j, Y H:i``. This default can be changed by calling the ``setDateFormat()`` method on the ``core`` extension instance. The first argument is the default format for -dates and the second one is the default format for date intervals: - -.. code-block:: php +dates and the second one is the default format for date intervals:: $twig = new \Twig\Environment($loader); $twig->getExtension(\Twig\Extension\CoreExtension::class)->setDateFormat('d/m/Y', '%d days'); @@ -62,9 +60,7 @@ {{ post.published_at|date("m/d/Y", false) }} -The default timezone can also be set globally by calling ``setTimezone()``: - -.. code-block:: php +The default timezone can also be set globally by calling ``setTimezone()``:: $twig = new \Twig\Environment($loader); $twig->getExtension(\Twig\Extension\CoreExtension::class)->setTimezone('Europe/Paris'); diff -Nru php-twig-2.14.1/doc/filters/default.rst php-twig-2.14.3/doc/filters/default.rst --- php-twig-2.14.1/doc/filters/default.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/default.rst 2021-01-07 21:35:24.000000000 +0000 @@ -22,7 +22,7 @@ {{ var.method(foo|default('foo'))|default('foo') }} -Using the ``default`` filter on a boolean variable might trigger unexpected behaviour, as +Using the ``default`` filter on a boolean variable might trigger unexpected behavior, as ``false`` is treated as an empty value. Consider using ``??`` instead: .. code-block:: twig diff -Nru php-twig-2.14.1/doc/filters/escape.rst php-twig-2.14.3/doc/filters/escape.rst --- php-twig-2.14.1/doc/filters/escape.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/escape.rst 2021-01-07 21:35:24.000000000 +0000 @@ -95,9 +95,7 @@ You can define custom escapers by calling the ``setEscaper()`` method on the escaper extension instance. The first argument is the escaper name (to be -used in the ``escape`` call) and the second one must be a valid PHP callable: - -.. code-block:: php +used in the ``escape`` call) and the second one must be a valid PHP callable:: $twig = new \Twig\Environment($loader); $twig->getExtension(\Twig\Extension\EscaperExtension::class)->setEscaper('csv', 'csv_escaper'); diff -Nru php-twig-2.14.1/doc/filters/filter.rst php-twig-2.14.3/doc/filters/filter.rst --- php-twig-2.14.1/doc/filters/filter.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/filter.rst 2021-01-07 21:35:24.000000000 +0000 @@ -1,8 +1,9 @@ ``filter`` ========== -.. versionadded:: 1.41 - The ``filter`` filter was added in Twig 1.41 and 2.10. +.. versionadded:: 2.10 + + The ``filter`` filter was added in Twig 2.10. The ``filter`` filter filters elements of a sequence or a mapping using an arrow function. The arrow function receives the value of the sequence or mapping: diff -Nru php-twig-2.14.1/doc/filters/format_currency.rst php-twig-2.14.3/doc/filters/format_currency.rst --- php-twig-2.14.1/doc/filters/format_currency.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/format_currency.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ =================== .. versionadded:: 2.12 + The ``format_currency`` filter was added in Twig 2.12. The ``format_currency`` filter formats a number as a currency: @@ -57,7 +58,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/format_date.rst php-twig-2.14.3/doc/filters/format_date.rst --- php-twig-2.14.1/doc/filters/format_date.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/format_date.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ =============== .. versionadded:: 2.12 + The ``format_date`` filter was added in Twig 2.12. The ``format_date`` filter formats a date. It behaves in the exact same way as @@ -14,7 +15,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/format_datetime.rst php-twig-2.14.3/doc/filters/format_datetime.rst --- php-twig-2.14.1/doc/filters/format_datetime.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/format_datetime.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,12 +2,11 @@ =================== .. versionadded:: 2.12 + The ``format_datetime`` filter was added in Twig 2.12. The ``format_datetime`` filter formats a date time: - public function formatDateTime(Environment $env, $date, ?string $dateFormat = 'medium', ?string $timeFormat = 'medium', string $pattern = '', $timezone = null, string $calendar = 'gregorian', string $locale = null): string - .. code-block:: twig {# Aug 7, 2019, 11:39:12 PM #} @@ -52,7 +51,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/format_number.rst php-twig-2.14.3/doc/filters/format_number.rst --- php-twig-2.14.1/doc/filters/format_number.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/format_number.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ================= .. versionadded:: 2.12 + The ``format_number`` filter was added in Twig 2.12. The ``format_number`` filter formats a number: @@ -97,7 +98,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/format.rst php-twig-2.14.3/doc/filters/format.rst --- php-twig-2.14.1/doc/filters/format.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/format.rst 2021-01-07 21:35:24.000000000 +0000 @@ -13,4 +13,6 @@ .. _`sprintf`: https://secure.php.net/sprintf -.. seealso:: :doc:`replace` +.. seealso:: + + :doc:`replace` diff -Nru php-twig-2.14.1/doc/filters/format_time.rst php-twig-2.14.3/doc/filters/format_time.rst --- php-twig-2.14.1/doc/filters/format_time.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/format_time.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ =============== .. versionadded:: 2.12 + The ``format_time`` filter was added in Twig 2.12. The ``format_time`` filter formats a time. It behaves in the exact same way as @@ -14,7 +15,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/html_to_markdown.rst php-twig-2.14.3/doc/filters/html_to_markdown.rst --- php-twig-2.14.1/doc/filters/html_to_markdown.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/html_to_markdown.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,11 +2,12 @@ ==================== .. versionadded:: 2.12 + The ``html_to_markdown`` filter was added in Twig 2.12. The ``html_to_markdown`` filter converts a block of HTML to Markdown: -.. code-block:: twig +.. code-block:: html+twig {% apply html_to_markdown %} @@ -27,14 +28,14 @@ .. code-block:: bash - $ composer req twig/markdown-extra + $ composer require twig/markdown-extra On Symfony projects, you can automatically enable it by installing the ``twig/extra-bundle``: .. code-block:: bash - $ composer req twig/extra-bundle + $ composer require twig/extra-bundle Or add the extension explicitly on the Twig environment:: @@ -67,7 +68,7 @@ Depending on the library, you can also add some options by passing them as an argument to the filter. Example for ``league/html-to-markdown``: -.. code-block:: twig +.. code-block:: html+twig {% apply html_to_markdown({hard_break: false}) %} diff -Nru php-twig-2.14.1/doc/filters/inky_to_html.rst php-twig-2.14.3/doc/filters/inky_to_html.rst --- php-twig-2.14.1/doc/filters/inky_to_html.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/inky_to_html.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,12 +2,13 @@ ================ .. versionadded:: 2.12 + The ``inky_to_html`` filter was added in Twig 2.12. The ``inky_to_html`` filter processes an `inky email template `_: -.. code-block:: twig +.. code-block:: html+twig {% apply inky_to_html %} @@ -29,7 +30,7 @@ .. code-block:: bash - $ composer req twig/inky-extra + $ composer require twig/inky-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/inline_css.rst php-twig-2.14.3/doc/filters/inline_css.rst --- php-twig-2.14.1/doc/filters/inline_css.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/inline_css.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,11 +2,12 @@ ============== .. versionadded:: 2.12 + The ``inline_css`` filter was added in Twig 2.12. The ``inline_css`` filter inline CSS styles in HTML documents: -.. code-block:: twig +.. code-block:: html+twig {% apply inline_css %} @@ -23,7 +24,7 @@ You can also add some stylesheets by passing them as arguments to the filter: -.. code-block:: twig +.. code-block:: html+twig {% apply inline_css(source("some_styles.css"), source("another.css")) %} @@ -53,7 +54,7 @@ .. code-block:: bash - $ composer req twig/cssinliner-extra + $ composer require twig/cssinliner-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/join.rst php-twig-2.14.3/doc/filters/join.rst --- php-twig-2.14.1/doc/filters/join.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/join.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ======== .. versionadded:: 2.6.1 + The ``and`` argument was added in Twig 2.6.1. The ``join`` filter returns a string which is the concatenation of the items diff -Nru php-twig-2.14.1/doc/filters/language_name.rst php-twig-2.14.3/doc/filters/language_name.rst --- php-twig-2.14.1/doc/filters/language_name.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/language_name.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ================= .. versionadded:: 2.12 + The ``language_name`` filter was added in Twig 2.12. The ``language_name`` filter returns the language name given its two-letter @@ -29,7 +30,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/locale_name.rst php-twig-2.14.3/doc/filters/locale_name.rst --- php-twig-2.14.1/doc/filters/locale_name.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/locale_name.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ =============== .. versionadded:: 2.12 + The ``locale_name`` filter was added in Twig 2.12. The ``locale_name`` filter returns the locale name given its two-letter @@ -29,7 +30,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/map.rst php-twig-2.14.3/doc/filters/map.rst --- php-twig-2.14.1/doc/filters/map.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/map.rst 2021-01-07 21:35:24.000000000 +0000 @@ -1,8 +1,9 @@ ``map`` ======= -.. versionadded:: 1.41 - The ``map`` filter was added in Twig 1.41 and 2.10. +.. versionadded:: 2.10 + + The ``map`` filter was added in Twig 2.10. The ``map`` filter applies an arrow function to the elements of a sequence or a mapping. The arrow function receives the value of the sequence or mapping: diff -Nru php-twig-2.14.1/doc/filters/markdown_to_html.rst php-twig-2.14.3/doc/filters/markdown_to_html.rst --- php-twig-2.14.1/doc/filters/markdown_to_html.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/markdown_to_html.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ==================== .. versionadded:: 2.12 + The ``markdown_to_html`` filter was added in Twig 2.12. The ``markdown_to_html`` filter converts a block of Markdown to HTML: @@ -42,7 +43,7 @@ .. code-block:: bash - $ composer req twig/markdown-extra + $ composer require twig/markdown-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/nl2br.rst php-twig-2.14.3/doc/filters/nl2br.rst --- php-twig-2.14.1/doc/filters/nl2br.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/nl2br.rst 2021-01-07 21:35:24.000000000 +0000 @@ -3,7 +3,7 @@ The ``nl2br`` filter inserts HTML line breaks before all newlines in a string: -.. code-block:: twig +.. code-block:: html+twig {{ "I like Twig.\nYou will like it too."|nl2br }} {# outputs diff -Nru php-twig-2.14.1/doc/filters/number_format.rst php-twig-2.14.3/doc/filters/number_format.rst --- php-twig-2.14.1/doc/filters/number_format.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/number_format.rst 2021-01-07 21:35:24.000000000 +0000 @@ -33,9 +33,7 @@ * ``.`` as the decimal point. * ``,`` as the thousands separator. -These defaults can be changed through the core extension: - -.. code-block:: php +These defaults can be changed through the core extension:: $twig = new \Twig\Environment($loader); $twig->getExtension(\Twig\Extension\CoreExtension::class)->setNumberFormat(3, '.', ','); diff -Nru php-twig-2.14.1/doc/filters/raw.rst php-twig-2.14.3/doc/filters/raw.rst --- php-twig-2.14.1/doc/filters/raw.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/raw.rst 2021-01-07 21:35:24.000000000 +0000 @@ -17,7 +17,7 @@ Be careful when using the ``raw`` filter inside expressions: - .. code-block:: twig + .. code-block:: html+twig {% autoescape %} {% set hello = 'Hello' %} diff -Nru php-twig-2.14.1/doc/filters/reduce.rst php-twig-2.14.3/doc/filters/reduce.rst --- php-twig-2.14.1/doc/filters/reduce.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/reduce.rst 2021-01-07 21:35:24.000000000 +0000 @@ -1,8 +1,9 @@ ``reduce`` ========== -.. versionadded:: 1.41 - The ``reduce`` filter was added in Twig 1.41 and 2.10. +.. versionadded:: 2.10 + + The ``reduce`` filter was added in Twig 2.10. The ``reduce`` filter iteratively reduces a sequence or a mapping to a single value using an arrow function, so as to reduce it to a single value. The arrow diff -Nru php-twig-2.14.1/doc/filters/replace.rst php-twig-2.14.3/doc/filters/replace.rst --- php-twig-2.14.1/doc/filters/replace.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/replace.rst 2021-01-07 21:35:24.000000000 +0000 @@ -22,4 +22,6 @@ * ``from``: The placeholder values -.. seealso:: :doc:`format` +.. seealso:: + + :doc:`format` diff -Nru php-twig-2.14.1/doc/filters/sort.rst php-twig-2.14.3/doc/filters/sort.rst --- php-twig-2.14.1/doc/filters/sort.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/sort.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ======== .. versionadded:: 2.12 + The ``arrow`` argument was added in Twig 2.12. The ``sort`` filter sorts an array: @@ -20,7 +21,7 @@ You can pass an arrow function to sort the array: -.. code-block:: twig +.. code-block:: html+twig {% set fruits = [ { name: 'Apples', quantity: 5 }, diff -Nru php-twig-2.14.1/doc/filters/spaceless.rst php-twig-2.14.3/doc/filters/spaceless.rst --- php-twig-2.14.1/doc/filters/spaceless.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/spaceless.rst 2021-01-07 21:35:24.000000000 +0000 @@ -1,14 +1,14 @@ ``spaceless`` ============= -.. versionadded:: 1.38 +.. versionadded:: 2.7 - The ``spaceless`` filter was added in Twig 1.38. + The ``spaceless`` filter was added in Twig 2.7. Use the ``spaceless`` filter to remove whitespace *between HTML tags*, not whitespace within HTML tags or whitespace in plain text: -.. code-block:: twig +.. code-block:: html+twig {{ "
@@ -21,7 +21,7 @@ You can combine ``spaceless`` with the ``apply`` tag to apply the transformation on large amounts of HTML: -.. code-block:: twig +.. code-block:: html+twig {% apply spaceless %}
diff -Nru php-twig-2.14.1/doc/filters/striptags.rst php-twig-2.14.3/doc/filters/striptags.rst --- php-twig-2.14.1/doc/filters/striptags.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/striptags.rst 2021-01-07 21:35:24.000000000 +0000 @@ -10,7 +10,7 @@ You can also provide tags which should not be stripped: -.. code-block:: twig +.. code-block:: html+twig {{ some_html|striptags('

') }} diff -Nru php-twig-2.14.1/doc/filters/timezone_name.rst php-twig-2.14.3/doc/filters/timezone_name.rst --- php-twig-2.14.1/doc/filters/timezone_name.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/timezone_name.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ================= .. versionadded:: 2.12 + The ``timezone_name`` filter was added in Twig 2.12. The ``timezone_name`` filter returns the timezone name given a timezone identifier: @@ -28,7 +29,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/filters/u.rst php-twig-2.14.3/doc/filters/u.rst --- php-twig-2.14.1/doc/filters/u.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/filters/u.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ===== .. versionadded:: 2.12.1 + The ``u`` filter was added in Twig 2.12.1. The ``u`` filter wraps a text in a Unicode object (a `Symfony UnicodeString @@ -74,7 +75,7 @@ .. code-block:: bash - $ composer req twig/string-extra + $ composer require twig/string-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/functions/block.rst php-twig-2.14.3/doc/functions/block.rst --- php-twig-2.14.1/doc/functions/block.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/functions/block.rst 2021-01-07 21:35:24.000000000 +0000 @@ -4,7 +4,7 @@ When a template uses inheritance and if you want to print a block multiple times, use the ``block`` function: -.. code-block:: twig +.. code-block:: html+twig {% block title %}{% endblock %} @@ -32,4 +32,6 @@ ... {% endif %} -.. seealso:: :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>` +.. seealso:: + + :doc:`extends<../tags/extends>`, :doc:`parent<../functions/parent>` diff -Nru php-twig-2.14.1/doc/functions/country_timezones.rst php-twig-2.14.3/doc/functions/country_timezones.rst --- php-twig-2.14.1/doc/functions/country_timezones.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/functions/country_timezones.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ===================== .. versionadded:: 2.12 + The ``country_timezones`` function was added in Twig 2.12. The ``country_timezones`` function returns the names of the timezones associated @@ -19,7 +20,7 @@ .. code-block:: bash - $ composer req twig/intl-extra + $ composer require twig/intl-extra Then, use the ``twig/extra-bundle`` on Symfony projects or add the extension explicitly on the Twig environment:: diff -Nru php-twig-2.14.1/doc/functions/date.rst php-twig-2.14.3/doc/functions/date.rst --- php-twig-2.14.1/doc/functions/date.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/functions/date.rst 2021-01-07 21:35:24.000000000 +0000 @@ -3,7 +3,7 @@ Converts an argument to a date to allow date comparison: -.. code-block:: twig +.. code-block:: html+twig {% if date(user.created_at) < date('-2days') %} {# do something #} @@ -13,7 +13,7 @@ You can pass a timezone as the second argument: -.. code-block:: twig +.. code-block:: html+twig {% if date(user.created_at) < date('-2days', 'Europe/Paris') %} {# do something #} @@ -21,7 +21,7 @@ If no argument is passed, the function returns the current date: -.. code-block:: twig +.. code-block:: html+twig {% if date(user.created_at) < date() %} {# always! #} @@ -30,9 +30,7 @@ .. note:: You can set the default timezone globally by calling ``setTimezone()`` on - the ``core`` extension instance: - - .. code-block:: php + the ``core`` extension instance:: $twig = new \Twig\Environment($loader); $twig->getExtension(\Twig\Extension\CoreExtension::class)->setTimezone('Europe/Paris'); diff -Nru php-twig-2.14.1/doc/functions/dump.rst php-twig-2.14.3/doc/functions/dump.rst --- php-twig-2.14.1/doc/functions/dump.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/functions/dump.rst 2021-01-07 21:35:24.000000000 +0000 @@ -28,7 +28,7 @@ In an HTML context, wrap the output with a ``pre`` tag to make it easier to read: -.. code-block:: twig +.. code-block:: html+twig

         {{ dump(user) }}
diff -Nru php-twig-2.14.1/doc/functions/html_classes.rst php-twig-2.14.3/doc/functions/html_classes.rst
--- php-twig-2.14.1/doc/functions/html_classes.rst	2020-11-21 19:34:32.000000000 +0000
+++ php-twig-2.14.3/doc/functions/html_classes.rst	2021-01-07 21:35:24.000000000 +0000
@@ -2,12 +2,13 @@
 ================
 
 .. versionadded:: 2.12
+
     The ``html_classes`` function was added in Twig 2.12.
 
 The ``html_classes`` function returns a string by conditionally joining class
 names together:
 
-.. code-block:: jinja
+.. code-block:: html+twig
 
     

`, :doc:`block<../functions/block>`, :doc:`block<../tags/block>` +.. seealso:: + + :doc:`extends<../tags/extends>`, :doc:`block<../functions/block>`, :doc:`block<../tags/block>` diff -Nru php-twig-2.14.1/doc/functions/random.rst php-twig-2.14.3/doc/functions/random.rst --- php-twig-2.14.1/doc/functions/random.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/functions/random.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ========== .. versionadded:: 2.7 + The "max" argument was added in Twig 2.7. The ``random`` function returns a random value depending on the supplied @@ -26,5 +27,3 @@ * ``values``: The values * ``max``: The max value when values is an integer - -.. _`mt_rand`: https://secure.php.net/mt_rand diff -Nru php-twig-2.14.1/doc/functions/template_from_string.rst php-twig-2.14.3/doc/functions/template_from_string.rst --- php-twig-2.14.1/doc/functions/template_from_string.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/functions/template_from_string.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ======================== .. versionadded:: 2.8 + The name argument was added in Twig 2.8. The ``template_from_string`` function loads a template from a string: diff -Nru php-twig-2.14.1/doc/intro.rst php-twig-2.14.3/doc/intro.rst --- php-twig-2.14.1/doc/intro.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/intro.rst 2021-01-07 21:35:24.000000000 +0000 @@ -40,9 +40,7 @@ Basic API Usage --------------- -This section gives you a brief introduction to the PHP API for Twig. - -.. code-block:: php +This section gives you a brief introduction to the PHP API for Twig:: require_once '/path/to/vendor/autoload.php'; diff -Nru php-twig-2.14.1/doc/recipes.rst php-twig-2.14.3/doc/recipes.rst --- php-twig-2.14.1/doc/recipes.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/recipes.rst 2021-01-07 21:35:24.000000000 +0000 @@ -299,7 +299,7 @@ When template code is provided by a third-party (through a web interface for instance), it might be interesting to validate the template syntax before -saving it. If the template code is stored in a `$template` variable, here is +saving it. If the template code is stored in a ``$template`` variable, here is how you can do it:: try { @@ -516,9 +516,7 @@ $interpolateProvider.startSymbol('{[').endSymbol(']}'); }); - * For Twig, change the delimiters via the ``tag_variable`` Lexer option: - - .. code-block:: php + * For Twig, change the delimiters via the ``tag_variable`` Lexer option:: $env->setLexer(new \Twig\Lexer($env, [ 'tag_variable' => ['{[', ']}'], diff -Nru php-twig-2.14.1/doc/tags/apply.rst php-twig-2.14.3/doc/tags/apply.rst --- php-twig-2.14.1/doc/tags/apply.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/apply.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ========= .. versionadded:: 2.9 + The ``apply`` tag was added in Twig 2.9. The ``apply`` tag allows you to apply Twig filters on a block of template data: @@ -14,7 +15,7 @@ You can also chain filters and pass arguments to them: -.. code-block:: twig +.. code-block:: html+twig {% apply lower|escape('html') %} SOME TEXT diff -Nru php-twig-2.14.1/doc/tags/autoescape.rst php-twig-2.14.3/doc/tags/autoescape.rst --- php-twig-2.14.1/doc/tags/autoescape.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/autoescape.rst 2021-01-07 21:35:24.000000000 +0000 @@ -47,7 +47,7 @@ Twig does not escape static expressions: - .. code-block:: twig + .. code-block:: html+twig {% set hello = "Hello" %} {{ hello }} diff -Nru php-twig-2.14.1/doc/tags/block.rst php-twig-2.14.3/doc/tags/block.rst --- php-twig-2.14.1/doc/tags/block.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/block.rst 2021-01-07 21:35:24.000000000 +0000 @@ -7,4 +7,6 @@ Block names must consist of alphanumeric characters, and underscores. The first char can't be a digit and dashes are not permitted. -.. seealso:: :doc:`block<../functions/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>`, :doc:`extends<../tags/extends>` +.. seealso:: + + :doc:`block<../functions/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>`, :doc:`extends<../tags/extends>` diff -Nru php-twig-2.14.1/doc/tags/deprecated.rst php-twig-2.14.3/doc/tags/deprecated.rst --- php-twig-2.14.1/doc/tags/deprecated.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/deprecated.rst 2021-01-07 21:35:24.000000000 +0000 @@ -2,6 +2,7 @@ ============== .. versionadded:: 2.6 + The ``deprecated`` tag was added in Twig 2.6. Twig generates a deprecation notice (via a call to the ``trigger_error()`` diff -Nru php-twig-2.14.1/doc/tags/embed.rst php-twig-2.14.3/doc/tags/embed.rst --- php-twig-2.14.1/doc/tags/embed.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/embed.rst 2021-01-07 21:35:24.000000000 +0000 @@ -1,7 +1,7 @@ ``embed`` ========= -The ``embed`` tag combines the behaviour of :doc:`include` and +The ``embed`` tag combines the behavior of :doc:`include` and :doc:`extends`. It allows you to include another template's contents, just like ``include`` does. But it also allows you to override any block defined inside the @@ -172,4 +172,6 @@ case, explicitly set the default auto-escaping strategy with the ``autoescape`` tag. -.. seealso:: :doc:`include<../tags/include>` +.. seealso:: + + :doc:`include<../tags/include>` diff -Nru php-twig-2.14.1/doc/tags/extends.rst php-twig-2.14.3/doc/tags/extends.rst --- php-twig-2.14.1/doc/tags/extends.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/extends.rst 2021-01-07 21:35:24.000000000 +0000 @@ -18,7 +18,7 @@ {% block head %} - + {% block title %}{% endblock %} - My Webpage {% endblock %} @@ -43,7 +43,7 @@ A child template might look like this: -.. code-block:: twig +.. code-block:: html+twig {% extends "base.html" %} @@ -79,7 +79,7 @@ If you want to print a block multiple times you can however use the ``block`` function: -.. code-block:: twig +.. code-block:: html+twig {% block title %}{% endblock %}

{{ block('title') }}

@@ -92,7 +92,7 @@ :doc:`parent<../functions/parent>` function. This gives back the results of the parent block: -.. code-block:: twig +.. code-block:: html+twig {% block sidebar %}

Table Of Contents

@@ -120,7 +120,7 @@ Blocks can be nested for more complex layouts. Per default, blocks have access to variables from outer scopes: -.. code-block:: twig +.. code-block:: html+twig {% for item in seq %}
  • {% block loop_item %}{{ item }}{% endblock %}
  • @@ -190,10 +190,9 @@ Let's take the following example to illustrate how a block works and more importantly, how it does not work: -.. code-block:: twig +.. code-block:: html+twig {# base.twig #} - {% for post in posts %} {% block post %}

    {{ post.title }}

    @@ -205,10 +204,9 @@ without the ``block`` tag. The ``block`` inside the ``for`` loop is just a way to make it overridable by a child template: -.. code-block:: twig +.. code-block:: html+twig {# child.twig #} - {% extends "base.twig" %} {% block post %} @@ -222,7 +220,7 @@ defined in the child template instead of the one defined in the base one; the executed template is then equivalent to the following one: -.. code-block:: twig +.. code-block:: html+twig {% for post in posts %}
    @@ -233,7 +231,7 @@ Let's take another example: a block included within an ``if`` statement: -.. code-block:: twig +.. code-block:: html+twig {% if posts is empty %} {% block head %} @@ -250,7 +248,7 @@ If you want the output to be displayed conditionally, use the following instead: -.. code-block:: twig +.. code-block:: html+twig {% block head %} {{ parent() }} @@ -260,4 +258,6 @@ {% endif %} {% endblock head %} -.. seealso:: :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` +.. seealso:: + + :doc:`block<../functions/block>`, :doc:`block<../tags/block>`, :doc:`parent<../functions/parent>`, :doc:`use<../tags/use>` diff -Nru php-twig-2.14.1/doc/tags/filter.rst php-twig-2.14.3/doc/tags/filter.rst --- php-twig-2.14.1/doc/tags/filter.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/filter.rst 2021-01-07 21:35:24.000000000 +0000 @@ -17,7 +17,7 @@ You can also chain filters and pass arguments to them: -.. code-block:: twig +.. code-block:: html+twig {% filter lower|escape('html') %} SOME TEXT diff -Nru php-twig-2.14.1/doc/tags/for.rst php-twig-2.14.3/doc/tags/for.rst --- php-twig-2.14.1/doc/tags/for.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/for.rst 2021-01-07 21:35:24.000000000 +0000 @@ -4,7 +4,7 @@ Loop over each item in a sequence. For example, to display a list of users provided in a variable called ``users``: -.. code-block:: twig +.. code-block:: html+twig

    Members

      @@ -95,7 +95,7 @@ can however filter the sequence during iteration which allows you to skip items. The following example skips all the users which are not active: -.. code-block:: twig +.. code-block:: html+twig
        {% for user in users if user.active %} @@ -121,7 +121,7 @@ If no iteration took place because the sequence was empty, you can render a replacement block by using ``else``: -.. code-block:: twig +.. code-block:: html+twig
          {% for user in users %} @@ -137,7 +137,7 @@ By default, a loop iterates over the values of the sequence. You can iterate on keys by using the ``keys`` filter: -.. code-block:: twig +.. code-block:: html+twig

          Members

            @@ -151,7 +151,7 @@ You can also access both keys and values: -.. code-block:: twig +.. code-block:: html+twig

            Members

              @@ -166,7 +166,7 @@ You might want to iterate over a subset of values. This can be achieved using the :doc:`slice <../filters/slice>` filter: -.. code-block:: twig +.. code-block:: html+twig

              Top Ten Members

                diff -Nru php-twig-2.14.1/doc/tags/if.rst php-twig-2.14.3/doc/tags/if.rst --- php-twig-2.14.1/doc/tags/if.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/if.rst 2021-01-07 21:35:24.000000000 +0000 @@ -6,7 +6,7 @@ In the simplest form you can use it to test if an expression evaluates to ``true``: -.. code-block:: twig +.. code-block:: html+twig {% if online == false %}

                Our website is in maintenance mode. Please, come back later.

                @@ -14,7 +14,7 @@ You can also test if an array is not empty: -.. code-block:: twig +.. code-block:: html+twig {% if users %}
                  @@ -31,7 +31,7 @@ You can also use ``not`` to check for values that evaluate to ``false``: -.. code-block:: twig +.. code-block:: html+twig {% if not user.subscribed %}

                  You are not subscribed to our mailing list.

                  @@ -39,7 +39,7 @@ For multiple conditions, ``and`` and ``or`` can be used: -.. code-block:: twig +.. code-block:: html+twig {% if temperature > 18 and temperature < 27 %}

                  It's a nice day for a walk in the park.

                  diff -Nru php-twig-2.14.1/doc/tags/include.rst php-twig-2.14.3/doc/tags/include.rst --- php-twig-2.14.1/doc/tags/include.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/include.rst 2021-01-07 21:35:24.000000000 +0000 @@ -31,10 +31,10 @@ {# vs #} {% set content = include('template.html') %} - {# Filter a rendered template #} - {% filter upper %} + {# Apply filter on a rendered template #} + {% apply upper %} {% include 'template.html' %} - {% endfilter %} + {% endapply %} {# vs #} {{ include('template.html')|upper }} diff -Nru php-twig-2.14.1/doc/tags/macro.rst php-twig-2.14.3/doc/tags/macro.rst --- php-twig-2.14.1/doc/tags/macro.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/macro.rst 2021-01-07 21:35:24.000000000 +0000 @@ -9,10 +9,10 @@ Imagine having a generic helper template that define how to render HTML forms via macros (called ``forms.html``): -.. code-block:: twig +.. code-block:: html+twig {% macro input(name, value, type = "text", size = 20) %} - + {% endmacro %} {% macro textarea(name, value, rows = 10, cols = 40) %} @@ -57,7 +57,7 @@ The macros can then be called at will in the *current* template: -.. code-block:: twig +.. code-block:: html+twig

                  {{ forms.input('username') }}

                  {{ forms.input('password', null, 'password') }}

                  @@ -65,7 +65,7 @@ Alternatively you can import names from the template into the current namespace via the ``from`` tag: -.. code-block:: twig +.. code-block:: html+twig {% from 'forms.html' import input as input_field, textarea %} @@ -78,18 +78,18 @@ import the macros as they are automatically available under the special ``_self`` variable: - .. code-block:: twig + .. code-block:: html+twig

                  {{ _self.input('password', '', 'password') }}

                  {% macro input(name, value, type = "text", size = 20) %} - + {% endmacro %} Auto-import is only available as of Twig 2.11. For older versions, import macros using the special ``_self`` variable for the template name: - .. code-block:: twig + .. code-block:: html+twig {% import _self as forms %} @@ -100,10 +100,10 @@ Before Twig 2.11, when you want to use a macro in another macro from the same file, you need to import it locally: - .. code-block:: twig + .. code-block:: html+twig {% macro input(name, value, type, size) %} - + {% endmacro %} {% macro wrapped_input(name, value, type, size) %} diff -Nru php-twig-2.14.1/doc/tags/set.rst php-twig-2.14.3/doc/tags/set.rst --- php-twig-2.14.1/doc/tags/set.rst 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/doc/tags/set.rst 2021-01-07 21:35:24.000000000 +0000 @@ -40,7 +40,7 @@ The ``set`` tag can also be used to 'capture' chunks of text: -.. code-block:: twig +.. code-block:: html+twig {% set foo %}
    value<br />
    - -
    value<br />
    diff -Nru php-twig-2.14.1/extra/inky-extra/tests/IntegrationTest.php php-twig-2.14.3/extra/inky-extra/tests/IntegrationTest.php --- php-twig-2.14.1/extra/inky-extra/tests/IntegrationTest.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/inky-extra/tests/IntegrationTest.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -{{ var }} +{%- endapply %} + +{{ include("inky")|inky_to_html }} +--TEMPLATE(inky)-- +{{ var }} +--DATA-- +return ['var' => 'value
    '] +--EXPECT-- +
    value<br />
    + +
    value<br />
    diff -Nru php-twig-2.14.1/extra/inky-extra/Tests/IntegrationTest.php php-twig-2.14.3/extra/inky-extra/Tests/IntegrationTest.php --- php-twig-2.14.1/extra/inky-extra/Tests/IntegrationTest.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/inky-extra/Tests/IntegrationTest.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,30 @@ + \IntlDateFormatter::NONE, + 'short' => \IntlDateFormatter::SHORT, + 'medium' => \IntlDateFormatter::MEDIUM, + 'long' => \IntlDateFormatter::LONG, + 'full' => \IntlDateFormatter::FULL, + ]; + private const NUMBER_TYPES = [ + 'default' => \NumberFormatter::TYPE_DEFAULT, + 'int32' => \NumberFormatter::TYPE_INT32, + 'int64' => \NumberFormatter::TYPE_INT64, + 'double' => \NumberFormatter::TYPE_DOUBLE, + 'currency' => \NumberFormatter::TYPE_CURRENCY, + ]; + private const NUMBER_STYLES = [ + 'decimal' => \NumberFormatter::DECIMAL, + 'currency' => \NumberFormatter::CURRENCY, + 'percent' => \NumberFormatter::PERCENT, + 'scientific' => \NumberFormatter::SCIENTIFIC, + 'spellout' => \NumberFormatter::SPELLOUT, + 'ordinal' => \NumberFormatter::ORDINAL, + 'duration' => \NumberFormatter::DURATION, + ]; + private const NUMBER_ATTRIBUTES = [ + 'grouping_used' => \NumberFormatter::GROUPING_USED, + 'decimal_always_shown' => \NumberFormatter::DECIMAL_ALWAYS_SHOWN, + 'max_integer_digit' => \NumberFormatter::MAX_INTEGER_DIGITS, + 'min_integer_digit' => \NumberFormatter::MIN_INTEGER_DIGITS, + 'integer_digit' => \NumberFormatter::INTEGER_DIGITS, + 'max_fraction_digit' => \NumberFormatter::MAX_FRACTION_DIGITS, + 'min_fraction_digit' => \NumberFormatter::MIN_FRACTION_DIGITS, + 'fraction_digit' => \NumberFormatter::FRACTION_DIGITS, + 'multiplier' => \NumberFormatter::MULTIPLIER, + 'grouping_size' => \NumberFormatter::GROUPING_SIZE, + 'rounding_mode' => \NumberFormatter::ROUNDING_MODE, + 'rounding_increment' => \NumberFormatter::ROUNDING_INCREMENT, + 'format_width' => \NumberFormatter::FORMAT_WIDTH, + 'padding_position' => \NumberFormatter::PADDING_POSITION, + 'secondary_grouping_size' => \NumberFormatter::SECONDARY_GROUPING_SIZE, + 'significant_digits_used' => \NumberFormatter::SIGNIFICANT_DIGITS_USED, + 'min_significant_digits_used' => \NumberFormatter::MIN_SIGNIFICANT_DIGITS, + 'max_significant_digits_used' => \NumberFormatter::MAX_SIGNIFICANT_DIGITS, + 'lenient_parse' => \NumberFormatter::LENIENT_PARSE, + ]; + private const NUMBER_ROUNDING_ATTRIBUTES = [ + 'ceiling' => \NumberFormatter::ROUND_CEILING, + 'floor' => \NumberFormatter::ROUND_FLOOR, + 'down' => \NumberFormatter::ROUND_DOWN, + 'up' => \NumberFormatter::ROUND_UP, + 'halfeven' => \NumberFormatter::ROUND_HALFEVEN, + 'halfdown' => \NumberFormatter::ROUND_HALFDOWN, + 'halfup' => \NumberFormatter::ROUND_HALFUP, + ]; + private const NUMBER_PADDING_ATTRIBUTES = [ + 'before_prefix' => \NumberFormatter::PAD_BEFORE_PREFIX, + 'after_prefix' => \NumberFormatter::PAD_AFTER_PREFIX, + 'before_suffix' => \NumberFormatter::PAD_BEFORE_SUFFIX, + 'after_suffix' => \NumberFormatter::PAD_AFTER_SUFFIX, + ]; + private const NUMBER_TEXT_ATTRIBUTES = [ + 'positive_prefix' => \NumberFormatter::POSITIVE_PREFIX, + 'positive_suffix' => \NumberFormatter::POSITIVE_SUFFIX, + 'negative_prefix' => \NumberFormatter::NEGATIVE_PREFIX, + 'negative_suffix' => \NumberFormatter::NEGATIVE_SUFFIX, + 'padding_character' => \NumberFormatter::PADDING_CHARACTER, + 'currency_mode' => \NumberFormatter::CURRENCY_CODE, + 'default_ruleset' => \NumberFormatter::DEFAULT_RULESET, + 'public_rulesets' => \NumberFormatter::PUBLIC_RULESETS, + ]; + private const NUMBER_SYMBOLS = [ + 'decimal_separator' => \NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, + 'grouping_separator' => \NumberFormatter::GROUPING_SEPARATOR_SYMBOL, + 'pattern_separator' => \NumberFormatter::PATTERN_SEPARATOR_SYMBOL, + 'percent' => \NumberFormatter::PERCENT_SYMBOL, + 'zero_digit' => \NumberFormatter::ZERO_DIGIT_SYMBOL, + 'digit' => \NumberFormatter::DIGIT_SYMBOL, + 'minus_sign' => \NumberFormatter::MINUS_SIGN_SYMBOL, + 'plus_sign' => \NumberFormatter::PLUS_SIGN_SYMBOL, + 'currency' => \NumberFormatter::CURRENCY_SYMBOL, + 'intl_currency' => \NumberFormatter::INTL_CURRENCY_SYMBOL, + 'monetary_separator' => \NumberFormatter::MONETARY_SEPARATOR_SYMBOL, + 'exponential' => \NumberFormatter::EXPONENTIAL_SYMBOL, + 'permill' => \NumberFormatter::PERMILL_SYMBOL, + 'pad_escape' => \NumberFormatter::PAD_ESCAPE_SYMBOL, + 'infinity' => \NumberFormatter::INFINITY_SYMBOL, + 'nan' => \NumberFormatter::NAN_SYMBOL, + 'significant_digit' => \NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL, + 'monetary_grouping_separator' => \NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, + ]; + + private $dateFormatters = []; + private $numberFormatters = []; + private $dateFormatterPrototype; + private $numberFormatterPrototype; + + public function __construct(\IntlDateFormatter $dateFormatterPrototype = null, \NumberFormatter $numberFormatterPrototype = null) + { + $this->dateFormatterPrototype = $dateFormatterPrototype; + $this->numberFormatterPrototype = $numberFormatterPrototype; + } + + public function getFilters() + { + return [ + // internationalized names + new TwigFilter('country_name', [$this, 'getCountryName']), + new TwigFilter('currency_name', [$this, 'getCurrencyName']), + new TwigFilter('currency_symbol', [$this, 'getCurrencySymbol']), + new TwigFilter('language_name', [$this, 'getLanguageName']), + new TwigFilter('locale_name', [$this, 'getLocaleName']), + new TwigFilter('timezone_name', [$this, 'getTimezoneName']), + + // localized formatters + new TwigFilter('format_currency', [$this, 'formatCurrency']), + new TwigFilter('format_number', [$this, 'formatNumber']), + new TwigFilter('format_*_number', [$this, 'formatNumberStyle']), + new TwigFilter('format_datetime', [$this, 'formatDateTime'], ['needs_environment' => true]), + new TwigFilter('format_date', [$this, 'formatDate'], ['needs_environment' => true]), + new TwigFilter('format_time', [$this, 'formatTime'], ['needs_environment' => true]), + ]; + } + + public function getFunctions() + { + return [ + // internationalized names + new TwigFunction('country_timezones', [$this, 'getCountryTimezones']), + ]; + } + + public function getCountryName(?string $country, string $locale = null): string + { + if (null === $country) { + return ''; + } + + try { + return Countries::getName($country, $locale); + } catch (MissingResourceException $exception) { + return $country; + } + } + + public function getCurrencyName(?string $currency, string $locale = null): string + { + if (null === $currency) { + return ''; + } + + try { + return Currencies::getName($currency, $locale); + } catch (MissingResourceException $exception) { + return $currency; + } + } + + public function getCurrencySymbol(?string $currency, string $locale = null): string + { + if (null === $currency) { + return ''; + } + + try { + return Currencies::getSymbol($currency, $locale); + } catch (MissingResourceException $exception) { + return $currency; + } + } + + public function getLanguageName(?string $language, string $locale = null): string + { + if (null === $language) { + return ''; + } + + try { + return Languages::getName($language, $locale); + } catch (MissingResourceException $exception) { + return $language; + } + } + + public function getLocaleName(?string $data, string $locale = null): string + { + if (null === $data) { + return ''; + } + + try { + return Locales::getName($data, $locale); + } catch (MissingResourceException $exception) { + return $data; + } + } + + public function getTimezoneName(?string $timezone, string $locale = null): string + { + if (null === $timezone) { + return ''; + } + + try { + return Timezones::getName($timezone, $locale); + } catch (MissingResourceException $exception) { + return $timezone; + } + } + + public function getCountryTimezones(string $country): array + { + try { + return Timezones::forCountryCode($country); + } catch (MissingResourceException $exception) { + return []; + } + } + + public function formatCurrency($amount, string $currency, array $attrs = [], string $locale = null): string + { + $formatter = $this->createNumberFormatter($locale, 'currency', $attrs); + + if (false === $ret = $formatter->formatCurrency($amount, $currency)) { + throw new RuntimeError('Unable to format the given number as a currency.'); + } + + return $ret; + } + + public function formatNumber($number, array $attrs = [], string $style = 'decimal', string $type = 'default', string $locale = null): string + { + if (!isset(self::NUMBER_TYPES[$type])) { + throw new RuntimeError(sprintf('The type "%s" does not exist, known types are: "%s".', $type, implode('", "', array_keys(self::NUMBER_TYPES)))); + } + + $formatter = $this->createNumberFormatter($locale, $style, $attrs); + + if (false === $ret = $formatter->format($number, self::NUMBER_TYPES[$type])) { + throw new RuntimeError('Unable to format the given number.'); + } + + return $ret; + } + + public function formatNumberStyle(string $style, $number, array $attrs = [], string $type = 'default', string $locale = null): string + { + return $this->formatNumber($number, $attrs, $style, $type, $locale); + } + + /** + * @param \DateTimeInterface|string|null $date A date or null to use the current time + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + */ + public function formatDateTime(Environment $env, $date, ?string $dateFormat = 'medium', ?string $timeFormat = 'medium', string $pattern = '', $timezone = null, string $calendar = 'gregorian', string $locale = null): string + { + $date = \twig_date_converter($env, $date, $timezone); + $formatter = $this->createDateFormatter($locale, $dateFormat, $timeFormat, $pattern, $date->getTimezone(), $calendar); + + if (false === $ret = $formatter->format($date)) { + throw new RuntimeError('Unable to format the given date.'); + } + + return $ret; + } + + /** + * @param \DateTimeInterface|string|null $date A date or null to use the current time + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + */ + public function formatDate(Environment $env, $date, ?string $dateFormat = 'medium', string $pattern = '', $timezone = null, string $calendar = 'gregorian', string $locale = null): string + { + return $this->formatDateTime($env, $date, $dateFormat, 'none', $pattern, $timezone, $calendar, $locale); + } + + /** + * @param \DateTimeInterface|string|null $date A date or null to use the current time + * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged + */ + public function formatTime(Environment $env, $date, ?string $timeFormat = 'medium', string $pattern = '', $timezone = null, string $calendar = 'gregorian', string $locale = null): string + { + return $this->formatDateTime($env, $date, 'none', $timeFormat, $pattern, $timezone, $calendar, $locale); + } + + private function createDateFormatter(?string $locale, ?string $dateFormat, ?string $timeFormat, string $pattern, \DateTimeZone $timezone, string $calendar): \IntlDateFormatter + { + if (null !== $dateFormat && !isset(self::DATE_FORMATS[$dateFormat])) { + throw new RuntimeError(sprintf('The date format "%s" does not exist, known formats are: "%s".', $dateFormat, implode('", "', array_keys(self::DATE_FORMATS)))); + } + + if (null !== $timeFormat && !isset(self::DATE_FORMATS[$timeFormat])) { + throw new RuntimeError(sprintf('The time format "%s" does not exist, known formats are: "%s".', $timeFormat, implode('", "', array_keys(self::DATE_FORMATS)))); + } + + if (null === $locale) { + $locale = \Locale::getDefault(); + } + + $calendar = 'gregorian' === $calendar ? \IntlDateFormatter::GREGORIAN : \IntlDateFormatter::TRADITIONAL; + + $dateFormatValue = self::DATE_FORMATS[$dateFormat] ?? null; + $timeFormatValue = self::DATE_FORMATS[$timeFormat] ?? null; + + if ($this->dateFormatterPrototype) { + $dateFormatValue = $dateFormatValue ?: $this->dateFormatterPrototype->getDateType(); + $timeFormatValue = $timeFormatValue ?: $this->dateFormatterPrototype->getTimeType(); + $timezone = $timezone ?: $this->dateFormatterPrototype->getTimeType(); + $calendar = $calendar ?: $this->dateFormatterPrototype->getCalendar(); + $pattern = $pattern ?: $this->dateFormatterPrototype->getPattern(); + } + + $hash = $locale.'|'.$dateFormatValue.'|'.$timeFormatValue.'|'.$timezone->getName().'|'.$calendar.'|'.$pattern; + + if (!isset($this->dateFormatters[$hash])) { + $this->dateFormatters[$hash] = new \IntlDateFormatter($locale, $dateFormatValue, $timeFormatValue, $timezone, $calendar, $pattern); + } + + return $this->dateFormatters[$hash]; + } + + private function createNumberFormatter(?string $locale, string $style, array $attrs = []): \NumberFormatter + { + if (!isset(self::NUMBER_STYLES[$style])) { + throw new RuntimeError(sprintf('The style "%s" does not exist, known styles are: "%s".', $style, implode('", "', array_keys(self::NUMBER_STYLES)))); + } + + if (null === $locale) { + $locale = \Locale::getDefault(); + } + + // textAttrs and symbols can only be set on the prototype as there is probably no + // use case for setting it on each call. + $textAttrs = []; + $symbols = []; + if ($this->numberFormatterPrototype) { + foreach (self::NUMBER_ATTRIBUTES as $name => $const) { + if (!isset($attrs[$name])) { + $value = $this->numberFormatterPrototype->getAttribute($const); + if ('rounding_mode' === $name) { + $value = array_flip(self::NUMBER_ROUNDING_ATTRIBUTES)[$value]; + } elseif ('padding_position' === $name) { + $value = array_flip(self::NUMBER_PADDING_ATTRIBUTES)[$value]; + } + $attrs[$name] = $value; + } + } + + foreach (self::NUMBER_TEXT_ATTRIBUTES as $name => $const) { + $textAttrs[$name] = $this->numberFormatterPrototype->getTextAttribute($const); + } + + foreach (self::NUMBER_SYMBOLS as $name => $const) { + $symbols[$name] = $this->numberFormatterPrototype->getSymbol($const); + } + } + + ksort($attrs); + $hash = $locale.'|'.$style.'|'.json_encode($attrs).'|'.json_encode($textAttrs).'|'.json_encode($symbols); + + if (!isset($this->numberFormatters[$hash])) { + $this->numberFormatters[$hash] = new \NumberFormatter($locale, self::NUMBER_STYLES[$style]); + } + + foreach ($attrs as $name => $value) { + if (!isset(self::NUMBER_ATTRIBUTES[$name])) { + throw new RuntimeError(sprintf('The number formatter attribute "%s" does not exist, known attributes are: "%s".', $name, implode('", "', array_keys(self::NUMBER_ATTRIBUTES)))); + } + + if ('rounding_mode' === $name) { + if (!isset(self::NUMBER_ROUNDING_ATTRIBUTES[$value])) { + throw new RuntimeError(sprintf('The number formatter rounding mode "%s" does not exist, known modes are: "%s".', $value, implode('", "', array_keys(self::NUMBER_ROUNDING_ATTRIBUTES)))); + } + + $value = self::NUMBER_ROUNDING_ATTRIBUTES[$value]; + } elseif ('padding_position' === $name) { + if (!isset(self::NUMBER_PADDING_ATTRIBUTES[$value])) { + throw new RuntimeError(sprintf('The number formatter padding position "%s" does not exist, known positions are: "%s".', $value, implode('", "', array_keys(self::NUMBER_PADDING_ATTRIBUTES)))); + } + + $value = self::NUMBER_PADDING_ATTRIBUTES[$value]; + } + + $this->numberFormatters[$hash]->setAttribute(self::NUMBER_ATTRIBUTES[$name], $value); + } + + foreach ($textAttrs as $name => $value) { + $this->numberFormatters[$hash]->setTextAttribute(self::NUMBER_TEXT_ATTRIBUTES[$name], $value); + } + + foreach ($symbols as $name => $value) { + $this->numberFormatters[$hash]->setSymbol(self::NUMBER_SYMBOLS[$name], $value); + } + + return $this->numberFormatters[$hash]; + } +} diff -Nru php-twig-2.14.1/extra/intl-extra/LICENSE php-twig-2.14.3/extra/intl-extra/LICENSE --- php-twig-2.14.1/extra/intl-extra/LICENSE 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/LICENSE 2021-01-07 21:35:24.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright (c) 2019-2020 Fabien Potencier +Copyright (c) 2019-2021 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -Nru php-twig-2.14.1/extra/intl-extra/phpunit.xml.dist php-twig-2.14.3/extra/intl-extra/phpunit.xml.dist --- php-twig-2.14.1/extra/intl-extra/phpunit.xml.dist 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/phpunit.xml.dist 2021-01-07 21:35:24.000000000 +0000 @@ -9,12 +9,13 @@ failOnWarning="true" > + - ./tests/ + ./Tests/ @@ -22,7 +23,7 @@ ./ - ./tests + ./Tests ./vendor diff -Nru php-twig-2.14.1/extra/intl-extra/src/IntlExtension.php php-twig-2.14.3/extra/intl-extra/src/IntlExtension.php --- php-twig-2.14.1/extra/intl-extra/src/IntlExtension.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/src/IntlExtension.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,421 +0,0 @@ - \IntlDateFormatter::NONE, - 'short' => \IntlDateFormatter::SHORT, - 'medium' => \IntlDateFormatter::MEDIUM, - 'long' => \IntlDateFormatter::LONG, - 'full' => \IntlDateFormatter::FULL, - ]; - private const NUMBER_TYPES = [ - 'default' => \NumberFormatter::TYPE_DEFAULT, - 'int32' => \NumberFormatter::TYPE_INT32, - 'int64' => \NumberFormatter::TYPE_INT64, - 'double' => \NumberFormatter::TYPE_DOUBLE, - 'currency' => \NumberFormatter::TYPE_CURRENCY, - ]; - private const NUMBER_STYLES = [ - 'decimal' => \NumberFormatter::DECIMAL, - 'currency' => \NumberFormatter::CURRENCY, - 'percent' => \NumberFormatter::PERCENT, - 'scientific' => \NumberFormatter::SCIENTIFIC, - 'spellout' => \NumberFormatter::SPELLOUT, - 'ordinal' => \NumberFormatter::ORDINAL, - 'duration' => \NumberFormatter::DURATION, - ]; - private const NUMBER_ATTRIBUTES = [ - 'grouping_used' => \NumberFormatter::GROUPING_USED, - 'decimal_always_shown' => \NumberFormatter::DECIMAL_ALWAYS_SHOWN, - 'max_integer_digit' => \NumberFormatter::MAX_INTEGER_DIGITS, - 'min_integer_digit' => \NumberFormatter::MIN_INTEGER_DIGITS, - 'integer_digit' => \NumberFormatter::INTEGER_DIGITS, - 'max_fraction_digit' => \NumberFormatter::MAX_FRACTION_DIGITS, - 'min_fraction_digit' => \NumberFormatter::MIN_FRACTION_DIGITS, - 'fraction_digit' => \NumberFormatter::FRACTION_DIGITS, - 'multiplier' => \NumberFormatter::MULTIPLIER, - 'grouping_size' => \NumberFormatter::GROUPING_SIZE, - 'rounding_mode' => \NumberFormatter::ROUNDING_MODE, - 'rounding_increment' => \NumberFormatter::ROUNDING_INCREMENT, - 'format_width' => \NumberFormatter::FORMAT_WIDTH, - 'padding_position' => \NumberFormatter::PADDING_POSITION, - 'secondary_grouping_size' => \NumberFormatter::SECONDARY_GROUPING_SIZE, - 'significant_digits_used' => \NumberFormatter::SIGNIFICANT_DIGITS_USED, - 'min_significant_digits_used' => \NumberFormatter::MIN_SIGNIFICANT_DIGITS, - 'max_significant_digits_used' => \NumberFormatter::MAX_SIGNIFICANT_DIGITS, - 'lenient_parse' => \NumberFormatter::LENIENT_PARSE, - ]; - private const NUMBER_ROUNDING_ATTRIBUTES = [ - 'ceiling' => \NumberFormatter::ROUND_CEILING, - 'floor' => \NumberFormatter::ROUND_FLOOR, - 'down' => \NumberFormatter::ROUND_DOWN, - 'up' => \NumberFormatter::ROUND_UP, - 'halfeven' => \NumberFormatter::ROUND_HALFEVEN, - 'halfdown' => \NumberFormatter::ROUND_HALFDOWN, - 'halfup' => \NumberFormatter::ROUND_HALFUP, - ]; - private const NUMBER_PADDING_ATTRIBUTES = [ - 'before_prefix' => \NumberFormatter::PAD_BEFORE_PREFIX, - 'after_prefix' => \NumberFormatter::PAD_AFTER_PREFIX, - 'before_suffix' => \NumberFormatter::PAD_BEFORE_SUFFIX, - 'after_suffix' => \NumberFormatter::PAD_AFTER_SUFFIX, - ]; - private const NUMBER_TEXT_ATTRIBUTES = [ - 'positive_prefix' => \NumberFormatter::POSITIVE_PREFIX, - 'positive_suffix' => \NumberFormatter::POSITIVE_SUFFIX, - 'negative_prefix' => \NumberFormatter::NEGATIVE_PREFIX, - 'negative_suffix' => \NumberFormatter::NEGATIVE_SUFFIX, - 'padding_character' => \NumberFormatter::PADDING_CHARACTER, - 'currency_mode' => \NumberFormatter::CURRENCY_CODE, - 'default_ruleset' => \NumberFormatter::DEFAULT_RULESET, - 'public_rulesets' => \NumberFormatter::PUBLIC_RULESETS, - ]; - private const NUMBER_SYMBOLS = [ - 'decimal_separator' => \NumberFormatter::DECIMAL_SEPARATOR_SYMBOL, - 'grouping_separator' => \NumberFormatter::GROUPING_SEPARATOR_SYMBOL, - 'pattern_separator' => \NumberFormatter::PATTERN_SEPARATOR_SYMBOL, - 'percent' => \NumberFormatter::PERCENT_SYMBOL, - 'zero_digit' => \NumberFormatter::ZERO_DIGIT_SYMBOL, - 'digit' => \NumberFormatter::DIGIT_SYMBOL, - 'minus_sign' => \NumberFormatter::MINUS_SIGN_SYMBOL, - 'plus_sign' => \NumberFormatter::PLUS_SIGN_SYMBOL, - 'currency' => \NumberFormatter::CURRENCY_SYMBOL, - 'intl_currency' => \NumberFormatter::INTL_CURRENCY_SYMBOL, - 'monetary_separator' => \NumberFormatter::MONETARY_SEPARATOR_SYMBOL, - 'exponential' => \NumberFormatter::EXPONENTIAL_SYMBOL, - 'permill' => \NumberFormatter::PERMILL_SYMBOL, - 'pad_escape' => \NumberFormatter::PAD_ESCAPE_SYMBOL, - 'infinity' => \NumberFormatter::INFINITY_SYMBOL, - 'nan' => \NumberFormatter::NAN_SYMBOL, - 'significant_digit' => \NumberFormatter::SIGNIFICANT_DIGIT_SYMBOL, - 'monetary_grouping_separator' => \NumberFormatter::MONETARY_GROUPING_SEPARATOR_SYMBOL, - ]; - - private $dateFormatters = []; - private $numberFormatters = []; - private $dateFormatterPrototype; - private $numberFormatterPrototype; - - public function __construct(\IntlDateFormatter $dateFormatterPrototype = null, \NumberFormatter $numberFormatterPrototype = null) - { - $this->dateFormatterPrototype = $dateFormatterPrototype; - $this->numberFormatterPrototype = $numberFormatterPrototype; - } - - public function getFilters() - { - return [ - // internationalized names - new TwigFilter('country_name', [$this, 'getCountryName']), - new TwigFilter('currency_name', [$this, 'getCurrencyName']), - new TwigFilter('currency_symbol', [$this, 'getCurrencySymbol']), - new TwigFilter('language_name', [$this, 'getLanguageName']), - new TwigFilter('locale_name', [$this, 'getLocaleName']), - new TwigFilter('timezone_name', [$this, 'getTimezoneName']), - - // localized formatters - new TwigFilter('format_currency', [$this, 'formatCurrency']), - new TwigFilter('format_number', [$this, 'formatNumber']), - new TwigFilter('format_*_number', [$this, 'formatNumberStyle']), - new TwigFilter('format_datetime', [$this, 'formatDateTime'], ['needs_environment' => true]), - new TwigFilter('format_date', [$this, 'formatDate'], ['needs_environment' => true]), - new TwigFilter('format_time', [$this, 'formatTime'], ['needs_environment' => true]), - ]; - } - - public function getFunctions() - { - return [ - // internationalized names - new TwigFunction('country_timezones', [$this, 'getCountryTimezones']), - ]; - } - - public function getCountryName(?string $country, string $locale = null): string - { - if (null === $country) { - return ''; - } - - try { - return Countries::getName($country, $locale); - } catch (MissingResourceException $exception) { - return $country; - } - } - - public function getCurrencyName(?string $currency, string $locale = null): string - { - if (null === $currency) { - return ''; - } - - try { - return Currencies::getName($currency, $locale); - } catch (MissingResourceException $exception) { - return $currency; - } - } - - public function getCurrencySymbol(?string $currency, string $locale = null): string - { - if (null === $currency) { - return ''; - } - - try { - return Currencies::getSymbol($currency, $locale); - } catch (MissingResourceException $exception) { - return $currency; - } - } - - public function getLanguageName(?string $language, string $locale = null): string - { - if (null === $language) { - return ''; - } - - try { - return Languages::getName($language, $locale); - } catch (MissingResourceException $exception) { - return $language; - } - } - - public function getLocaleName(?string $data, string $locale = null): string - { - if (null === $data) { - return ''; - } - - try { - return Locales::getName($data, $locale); - } catch (MissingResourceException $exception) { - return $data; - } - } - - public function getTimezoneName(?string $timezone, string $locale = null): string - { - if (null === $timezone) { - return ''; - } - - try { - return Timezones::getName($timezone, $locale); - } catch (MissingResourceException $exception) { - return $timezone; - } - } - - public function getCountryTimezones(string $country): array - { - try { - return Timezones::forCountryCode($country); - } catch (MissingResourceException $exception) { - return []; - } - } - - public function formatCurrency($amount, string $currency, array $attrs = [], string $locale = null): string - { - $formatter = $this->createNumberFormatter($locale, 'currency', $attrs); - - if (false === $ret = $formatter->formatCurrency($amount, $currency)) { - throw new RuntimeError('Unable to format the given number as a currency.'); - } - - return $ret; - } - - public function formatNumber($number, array $attrs = [], string $style = 'decimal', string $type = 'default', string $locale = null): string - { - if (!isset(self::NUMBER_TYPES[$type])) { - throw new RuntimeError(sprintf('The type "%s" does not exist, known types are: "%s".', $type, implode('", "', array_keys(self::NUMBER_TYPES)))); - } - - $formatter = $this->createNumberFormatter($locale, $style, $attrs); - - if (false === $ret = $formatter->format($number, self::NUMBER_TYPES[$type])) { - throw new RuntimeError('Unable to format the given number.'); - } - - return $ret; - } - - public function formatNumberStyle(string $style, $number, array $attrs = [], string $type = 'default', string $locale = null): string - { - return $this->formatNumber($number, $attrs, $style, $type, $locale); - } - - /** - * @param \DateTimeInterface|string|null $date A date or null to use the current time - * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged - */ - public function formatDateTime(Environment $env, $date, ?string $dateFormat = 'medium', ?string $timeFormat = 'medium', string $pattern = '', $timezone = null, string $calendar = 'gregorian', string $locale = null): string - { - $date = \twig_date_converter($env, $date, $timezone); - $formatter = $this->createDateFormatter($locale, $dateFormat, $timeFormat, $pattern, $date->getTimezone(), $calendar); - - if (false === $ret = $formatter->format($date)) { - throw new RuntimeError('Unable to format the given date.'); - } - - return $ret; - } - - /** - * @param \DateTimeInterface|string|null $date A date or null to use the current time - * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged - */ - public function formatDate(Environment $env, $date, ?string $dateFormat = 'medium', string $pattern = '', $timezone = null, string $calendar = 'gregorian', string $locale = null): string - { - return $this->formatDateTime($env, $date, $dateFormat, 'none', $pattern, $timezone, $calendar, $locale); - } - - /** - * @param \DateTimeInterface|string|null $date A date or null to use the current time - * @param \DateTimeZone|string|false|null $timezone The target timezone, null to use the default, false to leave unchanged - */ - public function formatTime(Environment $env, $date, ?string $timeFormat = 'medium', string $pattern = '', $timezone = null, string $calendar = 'gregorian', string $locale = null): string - { - return $this->formatDateTime($env, $date, 'none', $timeFormat, $pattern, $timezone, $calendar, $locale); - } - - private function createDateFormatter(?string $locale, ?string $dateFormat, ?string $timeFormat, string $pattern, \DateTimeZone $timezone, string $calendar): \IntlDateFormatter - { - if (null !== $dateFormat && !isset(self::DATE_FORMATS[$dateFormat])) { - throw new RuntimeError(sprintf('The date format "%s" does not exist, known formats are: "%s".', $dateFormat, implode('", "', array_keys(self::DATE_FORMATS)))); - } - - if (null !== $timeFormat && !isset(self::DATE_FORMATS[$timeFormat])) { - throw new RuntimeError(sprintf('The time format "%s" does not exist, known formats are: "%s".', $timeFormat, implode('", "', array_keys(self::DATE_FORMATS)))); - } - - if (null === $locale) { - $locale = \Locale::getDefault(); - } - - $calendar = 'gregorian' === $calendar ? \IntlDateFormatter::GREGORIAN : \IntlDateFormatter::TRADITIONAL; - - $dateFormatValue = self::DATE_FORMATS[$dateFormat] ?? null; - $timeFormatValue = self::DATE_FORMATS[$timeFormat] ?? null; - - if ($this->dateFormatterPrototype) { - $dateFormatValue = $dateFormatValue ?: $this->dateFormatterPrototype->getDateType(); - $timeFormatValue = $timeFormatValue ?: $this->dateFormatterPrototype->getTimeType(); - $timezone = $timezone ?: $this->dateFormatterPrototype->getTimeType(); - $calendar = $calendar ?: $this->dateFormatterPrototype->getCalendar(); - $pattern = $pattern ?: $this->dateFormatterPrototype->getPattern(); - } - - $hash = $locale.'|'.$dateFormatValue.'|'.$timeFormatValue.'|'.$timezone->getName().'|'.$calendar.'|'.$pattern; - - if (!isset($this->dateFormatters[$hash])) { - $this->dateFormatters[$hash] = new \IntlDateFormatter($locale, $dateFormatValue, $timeFormatValue, $timezone, $calendar, $pattern); - } - - return $this->dateFormatters[$hash]; - } - - private function createNumberFormatter(?string $locale, string $style, array $attrs = []): \NumberFormatter - { - if (!isset(self::NUMBER_STYLES[$style])) { - throw new RuntimeError(sprintf('The style "%s" does not exist, known styles are: "%s".', $style, implode('", "', array_keys(self::NUMBER_STYLES)))); - } - - if (null === $locale) { - $locale = \Locale::getDefault(); - } - - // textAttrs and symbols can only be set on the prototype as there is probably no - // use case for setting it on each call. - $textAttrs = []; - $symbols = []; - if ($this->numberFormatterPrototype) { - foreach (self::NUMBER_ATTRIBUTES as $name => $const) { - if (!isset($attrs[$name])) { - $value = $this->numberFormatterPrototype->getAttribute($const); - if ('rounding_mode' === $name) { - $value = array_flip(self::NUMBER_ROUNDING_ATTRIBUTES)[$value]; - } elseif ('padding_position' === $name) { - $value = array_flip(self::NUMBER_PADDING_ATTRIBUTES)[$value]; - } - $attrs[$name] = $value; - } - } - - foreach (self::NUMBER_TEXT_ATTRIBUTES as $name => $const) { - $textAttrs[$name] = $this->numberFormatterPrototype->getTextAttribute($const); - } - - foreach (self::NUMBER_SYMBOLS as $name => $const) { - $symbols[$name] = $this->numberFormatterPrototype->getSymbol($const); - } - } - - ksort($attrs); - $hash = $locale.'|'.$style.'|'.json_encode($attrs).'|'.json_encode($textAttrs).'|'.json_encode($symbols); - - if (!isset($this->numberFormatters[$hash])) { - $this->numberFormatters[$hash] = new \NumberFormatter($locale, self::NUMBER_STYLES[$style]); - } - - foreach ($attrs as $name => $value) { - if (!isset(self::NUMBER_ATTRIBUTES[$name])) { - throw new RuntimeError(sprintf('The number formatter attribute "%s" does not exist, known attributes are: "%s".', $name, implode('", "', array_keys(self::NUMBER_ATTRIBUTES)))); - } - - if ('rounding_mode' === $name) { - if (!isset(self::NUMBER_ROUNDING_ATTRIBUTES[$value])) { - throw new RuntimeError(sprintf('The number formatter rounding mode "%s" does not exist, known modes are: "%s".', $value, implode('", "', array_keys(self::NUMBER_ROUNDING_ATTRIBUTES)))); - } - - $value = self::NUMBER_ROUNDING_ATTRIBUTES[$value]; - } elseif ('padding_position' === $name) { - if (!isset(self::NUMBER_PADDING_ATTRIBUTES[$value])) { - throw new RuntimeError(sprintf('The number formatter padding position "%s" does not exist, known positions are: "%s".', $value, implode('", "', array_keys(self::NUMBER_PADDING_ATTRIBUTES)))); - } - - $value = self::NUMBER_PADDING_ATTRIBUTES[$value]; - } - - $this->numberFormatters[$hash]->setAttribute(self::NUMBER_ATTRIBUTES[$name], $value); - } - - foreach ($textAttrs as $name => $value) { - $this->numberFormatters[$hash]->setTextAttribute(self::NUMBER_TEXT_ATTRIBUTES[$name], $value); - } - - foreach ($symbols as $name => $value) { - $this->numberFormatters[$hash]->setSymbol(self::NUMBER_SYMBOLS[$name], $value); - } - - return $this->numberFormatters[$hash]; - } -} diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/country_name.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/country_name.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/country_name.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/country_name.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ ---TEST-- -"country_name" filter ---TEMPLATE-- -{{ 'UNKNOWN'|country_name }} -{{ null|country_name }} -{{ 'FR'|country_name }} -{{ 'US'|country_name }} -{{ 'US'|country_name('fr') }} -{{ 'CH'|country_name('fr_CA') }} ---DATA-- -return []; ---EXPECT-- -UNKNOWN - -France -United States -États-Unis -Suisse diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/country_timezones.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/country_timezones.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/country_timezones.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/country_timezones.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ ---TEST-- -"country_timezones" function ---TEMPLATE-- -{{ country_timezones('UNKNOWN')|length }} -{{ country_timezones('FR')|join(', ') }} -{{ country_timezones('US')|join(', ') }} ---DATA-- -return []; ---EXPECT-- -0 -Europe/Paris -America/Adak, America/Anchorage, America/Boise, America/Chicago, America/Denver, America/Detroit, America/Indiana/Knox, America/Indiana/Marengo, America/Indiana/Petersburg, America/Indiana/Tell_City, America/Indiana/Vevay, America/Indiana/Vincennes, America/Indiana/Winamac, America/Indianapolis, America/Juneau, America/Kentucky/Monticello, America/Los_Angeles, America/Louisville, America/Menominee, America/Metlakatla, America/New_York, America/Nome, America/North_Dakota/Beulah, America/North_Dakota/Center, America/North_Dakota/New_Salem, America/Phoenix, America/Sitka, America/Yakutat, Pacific/Honolulu diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/currency_name.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/currency_name.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/currency_name.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/currency_name.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,18 +0,0 @@ ---TEST-- -"currency_name" filter ---TEMPLATE-- -{{ 'UNKNOWN'|currency_name }} -{{ null|currency_name }} -{{ 'EUR'|currency_name }} -{{ 'JPY'|currency_name }} -{{ 'EUR'|currency_name('fr') }} -{{ 'JPY'|currency_name('fr_FR') }} ---DATA-- -return []; ---EXPECT-- -UNKNOWN - -Euro -Japanese Yen -euro -yen japonais diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/currency_symbol.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/currency_symbol.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/currency_symbol.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/currency_symbol.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ ---TEST-- -"currency_symbol" filter ---TEMPLATE-- -{{ 'UNKNOWN'|currency_symbol }} -{{ null|currency_symbol }} -{{ 'EUR'|currency_symbol }} -{{ 'JPY'|currency_symbol }} ---DATA-- -return []; ---EXPECT-- -UNKNOWN - -€ -¥ diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/format_currency.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/format_currency.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/format_currency.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/format_currency.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ---TEST-- -"format_currency" filter ---TEMPLATE-- -{{ '1000000'|format_currency('EUR') }} -{{ '1000000'|format_currency('EUR', locale='de') }} -{{ '1000000'|format_currency('EUR', {fraction_digit: 2}) }} -{{ '12.345'|format_currency('EUR', {rounding_mode: 'floor'}) }} -{{ '125000'|format_currency('YEN') }} ---DATA-- -return []; ---EXPECT-- -€1,000,000.00 -1.000.000,00 € -€1,000,000.00 -€12.34 -YEN125,000.00 diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/format_date.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/format_date.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/format_date.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/format_date.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ ---TEST-- -"format_date" filter ---TEMPLATE-- -{{ '2019-08-07 23:39:12'|format_datetime() }} -{{ '2019-08-07 23:39:12'|format_datetime(locale='fr') }} -{{ '2019-08-07 23:39:12'|format_datetime('none', 'short', locale='fr') }} -{{ '2019-08-07 23:39:12'|format_datetime('short', 'none', locale='fr') }} -{{ '2019-08-07 23:39:12'|format_datetime('full', 'full', locale='fr') }} -{{ '2019-08-07 23:39:12'|format_datetime(pattern="hh 'oclock' a, zzzz") }} - -{{ '2019-08-07 23:39:12'|format_date }} -{{ '2019-08-07 23:39:12'|format_date(locale='fr') }} -{{ '2019-08-07 23:39:12'|format_time }} ---DATA-- -return []; ---EXPECT-- -Aug 7, 2019, 11:39:12 PM -7 août 2019 23:39:12 -23:39 -07/08/2019 -mercredi 7 août 2019 23:39:12 UTC -11 oclock PM, GMT - -Aug 7, 2019 -7 août 2019 -11:39:12 PM diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/format_number.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/format_number.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/format_number.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/format_number.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ ---TEST-- -"format_number" filter ---TEMPLATE-- -{{ '12.345'|format_number }} -{{ '12.345'|format_number(locale='fr') }} -{{ '12.345'|format_number(style='percent') }} -{{ '12.345'|format_number(style='spellout') }} -{{ '12.345'|format_percent_number }} -{{ '12.345'|format_spellout_number }} -{{ '80.345'|format_spellout_number(locale='fr_FR') }} -{{ '80.345'|format_spellout_number(locale='fr_CH') }} -{{ '12'|format_duration_number }} -{{ '0.12'|format_percent_number({fraction_digit: 1}) }} -{{ '0.12345'|format_percent_number({rounding_mode: 'ceiling'}) }} ---DATA-- -return []; ---EXPECT-- -12.345 -12,345 -1,234% -twelve point three four five -1,234% -twelve point three four five -quatre-vingts virgule trois quatre cinq -huitante virgule trois quatre cinq -12 sec. -12.0% -13% diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/language_name.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/language_name.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/language_name.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/language_name.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ ---TEST-- -"language_name" filter ---TEMPLATE-- -{{ 'UNKNOWN'|language_name }} -{{ null|language_name }} -{{ 'de'|language_name }} -{{ 'fr'|language_name }} -{{ 'de'|language_name('fr') }} -{{ 'fr'|language_name('fr_FR') }} -{{ 'fr_CA'|language_name('fr_FR') }} ---DATA-- -return []; ---EXPECT-- -UNKNOWN - -German -French -allemand -français -français canadien diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/locale_name.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/locale_name.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/locale_name.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/locale_name.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ ---TEST-- -"locale_name" filter ---TEMPLATE-- -{{ 'UNKNOWN'|locale_name }} -{{ null|locale_name }} -{{ 'de'|locale_name }} -{{ 'fr'|locale_name }} -{{ 'de'|locale_name('fr') }} -{{ 'fr'|locale_name('fr_FR') }} -{{ 'fr_CA'|locale_name('fr_FR') }} ---DATA-- -return []; ---EXPECT-- -UNKNOWN - -German -French -allemand -français -français (Canada) diff -Nru php-twig-2.14.1/extra/intl-extra/tests/Fixtures/timezone_name.test php-twig-2.14.3/extra/intl-extra/tests/Fixtures/timezone_name.test --- php-twig-2.14.1/extra/intl-extra/tests/Fixtures/timezone_name.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/Fixtures/timezone_name.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ ---TEST-- -"timezone_name" filter ---TEMPLATE-- -{{ 'UNKNOWN'|timezone_name }} -{{ null|timezone_name }} -{{ 'Europe/Paris'|timezone_name }} -{{ 'America/Los_Angeles'|timezone_name }} -{{ 'America/Los_Angeles'|timezone_name('fr') }} ---DATA-- -return []; ---EXPECT-- -UNKNOWN - -Central European Time (Paris) -Pacific Time (Los Angeles) -heure du Pacifique nord-américain (Los Angeles) diff -Nru php-twig-2.14.1/extra/intl-extra/tests/IntegrationTest.php php-twig-2.14.3/extra/intl-extra/tests/IntegrationTest.php --- php-twig-2.14.1/extra/intl-extra/tests/IntegrationTest.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/tests/IntegrationTest.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -setTextAttribute(\NumberFormatter::POSITIVE_PREFIX, '++'); - $numberFormatterProto->setAttribute(\NumberFormatter::FRACTION_DIGITS, 1); - $ext = new IntlExtension($dateFormatterProto, $numberFormatterProto); - $this->assertSame('++12,3', $ext->formatNumber('12.3456')); - } -} diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/country_name.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/country_name.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/country_name.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/country_name.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,18 @@ +--TEST-- +"country_name" filter +--TEMPLATE-- +{{ 'UNKNOWN'|country_name }} +{{ null|country_name }} +{{ 'FR'|country_name }} +{{ 'US'|country_name }} +{{ 'US'|country_name('fr') }} +{{ 'CH'|country_name('fr_CA') }} +--DATA-- +return []; +--EXPECT-- +UNKNOWN + +France +United States +États-Unis +Suisse diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/country_timezones.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/country_timezones.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/country_timezones.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/country_timezones.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,12 @@ +--TEST-- +"country_timezones" function +--TEMPLATE-- +{{ country_timezones('UNKNOWN')|length }} +{{ country_timezones('FR')|join(', ') }} +{{ country_timezones('US')|join(', ') }} +--DATA-- +return []; +--EXPECT-- +0 +Europe/Paris +America/Adak, America/Anchorage, America/Boise, America/Chicago, America/Denver, America/Detroit, America/Indiana/Knox, America/Indiana/Marengo, America/Indiana/Petersburg, America/Indiana/Tell_City, America/Indiana/Vevay, America/Indiana/Vincennes, America/Indiana/Winamac, America/Indianapolis, America/Juneau, America/Kentucky/Monticello, America/Los_Angeles, America/Louisville, America/Menominee, America/Metlakatla, America/New_York, America/Nome, America/North_Dakota/Beulah, America/North_Dakota/Center, America/North_Dakota/New_Salem, America/Phoenix, America/Sitka, America/Yakutat, Pacific/Honolulu diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/currency_name.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/currency_name.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/currency_name.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/currency_name.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,18 @@ +--TEST-- +"currency_name" filter +--TEMPLATE-- +{{ 'UNKNOWN'|currency_name }} +{{ null|currency_name }} +{{ 'EUR'|currency_name }} +{{ 'JPY'|currency_name }} +{{ 'EUR'|currency_name('fr') }} +{{ 'JPY'|currency_name('fr_FR') }} +--DATA-- +return []; +--EXPECT-- +UNKNOWN + +Euro +Japanese Yen +euro +yen japonais diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/currency_symbol.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/currency_symbol.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/currency_symbol.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/currency_symbol.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,14 @@ +--TEST-- +"currency_symbol" filter +--TEMPLATE-- +{{ 'UNKNOWN'|currency_symbol }} +{{ null|currency_symbol }} +{{ 'EUR'|currency_symbol }} +{{ 'JPY'|currency_symbol }} +--DATA-- +return []; +--EXPECT-- +UNKNOWN + +€ +¥ diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/format_currency.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/format_currency.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/format_currency.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/format_currency.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,16 @@ +--TEST-- +"format_currency" filter +--TEMPLATE-- +{{ '1000000'|format_currency('EUR') }} +{{ '1000000'|format_currency('EUR', locale='de') }} +{{ '1000000'|format_currency('EUR', {fraction_digit: 2}) }} +{{ '12.345'|format_currency('EUR', {rounding_mode: 'floor'}) }} +{{ '125000'|format_currency('YEN') }} +--DATA-- +return []; +--EXPECT-- +€1,000,000.00 +1.000.000,00 € +€1,000,000.00 +€12.34 +YEN 125,000.00 diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/format_date.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/format_date.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/format_date.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/format_date.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,26 @@ +--TEST-- +"format_date" filter +--TEMPLATE-- +{{ '2019-08-07 23:39:12'|format_datetime() }} +{{ '2019-08-07 23:39:12'|format_datetime(locale='fr') }} +{{ '2019-08-07 23:39:12'|format_datetime('none', 'short', locale='fr') }} +{{ '2019-08-07 23:39:12'|format_datetime('short', 'none', locale='fr') }} +{{ '2019-08-07 23:39:12'|format_datetime('full', 'full', locale='fr') }} +{{ '2019-08-07 23:39:12'|format_datetime(pattern="hh 'oclock' a, zzzz") }} + +{{ '2019-08-07 23:39:12'|format_date }} +{{ '2019-08-07 23:39:12'|format_date(locale='fr') }} +{{ '2019-08-07 23:39:12'|format_time }} +--DATA-- +return []; +--EXPECT-- +Aug 7, 2019, 11:39:12 PM +7 août 2019 à 23:39:12 +23:39 +07/08/2019 +mercredi 7 août 2019 à 23:39:12 Temps universel coordonné +11 oclock PM, Coordinated Universal Time + +Aug 7, 2019 +7 août 2019 +11:39:12 PM diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/format_number.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/format_number.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/format_number.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/format_number.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,28 @@ +--TEST-- +"format_number" filter +--TEMPLATE-- +{{ '12.345'|format_number }} +{{ '12.345'|format_number(locale='fr') }} +{{ '12.345'|format_number(style='percent') }} +{{ '12.345'|format_number(style='spellout') }} +{{ '12.345'|format_percent_number }} +{{ '12.345'|format_spellout_number }} +{{ '80.345'|format_spellout_number(locale='fr_FR') }} +{{ '80.345'|format_spellout_number(locale='fr_CH') }} +{{ '12'|format_duration_number }} +{{ '0.12'|format_percent_number({fraction_digit: 1}) }} +{{ '0.12345'|format_percent_number({rounding_mode: 'ceiling'}) }} +--DATA-- +return []; +--EXPECT-- +12.345 +12,345 +1,234% +twelve point three four five +1,234% +twelve point three four five +quatre-vingts virgule trois quatre cinq +huitante virgule trois quatre cinq +12 sec. +12.0% +13% diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/language_name.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/language_name.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/language_name.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/language_name.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,20 @@ +--TEST-- +"language_name" filter +--TEMPLATE-- +{{ 'UNKNOWN'|language_name }} +{{ null|language_name }} +{{ 'de'|language_name }} +{{ 'fr'|language_name }} +{{ 'de'|language_name('fr') }} +{{ 'fr'|language_name('fr_FR') }} +{{ 'fr_CA'|language_name('fr_FR') }} +--DATA-- +return []; +--EXPECT-- +UNKNOWN + +German +French +allemand +français +français canadien diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/locale_name.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/locale_name.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/locale_name.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/locale_name.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,20 @@ +--TEST-- +"locale_name" filter +--TEMPLATE-- +{{ 'UNKNOWN'|locale_name }} +{{ null|locale_name }} +{{ 'de'|locale_name }} +{{ 'fr'|locale_name }} +{{ 'de'|locale_name('fr') }} +{{ 'fr'|locale_name('fr_FR') }} +{{ 'fr_CA'|locale_name('fr_FR') }} +--DATA-- +return []; +--EXPECT-- +UNKNOWN + +German +French +allemand +français +français (Canada) diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/timezone_name.test php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/timezone_name.test --- php-twig-2.14.1/extra/intl-extra/Tests/Fixtures/timezone_name.test 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/Fixtures/timezone_name.test 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,16 @@ +--TEST-- +"timezone_name" filter +--TEMPLATE-- +{{ 'UNKNOWN'|timezone_name }} +{{ null|timezone_name }} +{{ 'Europe/Paris'|timezone_name }} +{{ 'America/Los_Angeles'|timezone_name }} +{{ 'America/Los_Angeles'|timezone_name('fr') }} +--DATA-- +return []; +--EXPECT-- +UNKNOWN + +Central European Time (Paris) +Pacific Time (Los Angeles) +heure du Pacifique nord-américain (Los Angeles) diff -Nru php-twig-2.14.1/extra/intl-extra/Tests/IntegrationTest.php php-twig-2.14.3/extra/intl-extra/Tests/IntegrationTest.php --- php-twig-2.14.1/extra/intl-extra/Tests/IntegrationTest.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/intl-extra/Tests/IntegrationTest.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,30 @@ +setTextAttribute(\NumberFormatter::POSITIVE_PREFIX, '++'); + $numberFormatterProto->setAttribute(\NumberFormatter::FRACTION_DIGITS, 1); + $ext = new IntlExtension($dateFormatterProto, $numberFormatterProto); + $this->assertSame('++12,3', $ext->formatNumber('12.3456')); + } +} diff -Nru php-twig-2.14.1/extra/markdown-extra/composer.json php-twig-2.14.3/extra/markdown-extra/composer.json --- php-twig-2.14.1/extra/markdown-extra/composer.json 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/composer.json 2021-01-07 21:35:24.000000000 +0000 @@ -26,18 +26,14 @@ "michelf/php-markdown": "^1.8" }, "autoload": { - "psr-4" : { - "Twig\\Extra\\Markdown\\" : "src/" - } - }, - "autoload-dev": { - "psr-4" : { - "Twig\\Extra\\Markdown\\Tests\\" : "tests/" - } + "psr-4" : { "Twig\\Extra\\Markdown\\" : "" }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "extra": { "branch-alias": { - "dev-master": "2.12-dev" + "dev-master": "2.14-dev" } } } diff -Nru php-twig-2.14.1/extra/markdown-extra/DefaultMarkdown.php php-twig-2.14.3/extra/markdown-extra/DefaultMarkdown.php --- php-twig-2.14.1/extra/markdown-extra/DefaultMarkdown.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/DefaultMarkdown.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,39 @@ +converter = new ErusevMarkdown(); + } elseif (class_exists(CommonMarkConverter::class)) { + $this->converter = new LeagueMarkdown(); + } elseif (class_exists(MarkdownExtra::class)) { + $this->converter = new MichelfMarkdown(); + } else { + throw new \LogicException('You cannot use the "markdown_to_html" filter as no Markdown library is available; try running "composer require erusev/parsedown".'); + } + } + + public function convert(string $body): string + { + return $this->converter->convert($body); + } +} diff -Nru php-twig-2.14.1/extra/markdown-extra/ErusevMarkdown.php php-twig-2.14.3/extra/markdown-extra/ErusevMarkdown.php --- php-twig-2.14.1/extra/markdown-extra/ErusevMarkdown.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/ErusevMarkdown.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,29 @@ +converter = $converter ?: new Parsedown(); + } + + public function convert(string $body): string + { + return $this->converter->text($body); + } +} diff -Nru php-twig-2.14.1/extra/markdown-extra/LeagueMarkdown.php php-twig-2.14.3/extra/markdown-extra/LeagueMarkdown.php --- php-twig-2.14.1/extra/markdown-extra/LeagueMarkdown.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/LeagueMarkdown.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,29 @@ +converter = $converter ?: new CommonMarkConverter(); + } + + public function convert(string $body): string + { + return $this->converter->convertToHtml($body); + } +} diff -Nru php-twig-2.14.1/extra/markdown-extra/LICENSE php-twig-2.14.3/extra/markdown-extra/LICENSE --- php-twig-2.14.1/extra/markdown-extra/LICENSE 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/LICENSE 2021-01-07 21:35:24.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright (c) 2019-2020 Fabien Potencier +Copyright (c) 2019-2021 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -Nru php-twig-2.14.1/extra/markdown-extra/MarkdownExtension.php php-twig-2.14.3/extra/markdown-extra/MarkdownExtension.php --- php-twig-2.14.1/extra/markdown-extra/MarkdownExtension.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/MarkdownExtension.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,48 @@ + ['all']]), + new TwigFilter('html_to_markdown', 'Twig\\Extra\\Markdown\\twig_html_to_markdown', ['is_safe' => ['all']]), + ]; + } +} + +function twig_html_to_markdown(string $body, array $options = []): string +{ + static $converters; + + if (!class_exists(HtmlConverter::class)) { + throw new \LogicException('You cannot use the "html_to_markdown" filter as league/html-to-markdown is not installed; try running "composer require league/html-to-markdown".'); + } + + $options = $options + [ + 'hard_break' => true, + 'strip_tags' => true, + 'remove_nodes' => 'head style', + ]; + + if (!isset($converters[$key = serialize($options)])) { + $converters[$key] = new HtmlConverter($options); + } + + return $converters[$key]->convert($body); +} diff -Nru php-twig-2.14.1/extra/markdown-extra/MarkdownInterface.php php-twig-2.14.3/extra/markdown-extra/MarkdownInterface.php --- php-twig-2.14.1/extra/markdown-extra/MarkdownInterface.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/MarkdownInterface.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,17 @@ +converter = $converter; + } + + public function convert(string $body): string + { + // remove indentation + if ($white = substr($body, 0, strspn($body, " \t\r\n\0\x0B"))) { + $body = preg_replace("{^$white}m", '', $body); + } + + return $this->converter->convert($body); + } +} diff -Nru php-twig-2.14.1/extra/markdown-extra/MichelfMarkdown.php php-twig-2.14.3/extra/markdown-extra/MichelfMarkdown.php --- php-twig-2.14.1/extra/markdown-extra/MichelfMarkdown.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/MichelfMarkdown.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,34 @@ +hard_wrap = true; + } + + $this->converter = $converter; + } + + public function convert(string $body): string + { + return $this->converter->transform($body); + } +} diff -Nru php-twig-2.14.1/extra/markdown-extra/phpunit.xml.dist php-twig-2.14.3/extra/markdown-extra/phpunit.xml.dist --- php-twig-2.14.1/extra/markdown-extra/phpunit.xml.dist 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/phpunit.xml.dist 2021-01-07 21:35:24.000000000 +0000 @@ -14,7 +14,7 @@ - ./tests/ + ./Tests/ @@ -22,7 +22,7 @@ ./ - ./tests + ./Tests ./vendor diff -Nru php-twig-2.14.1/extra/markdown-extra/src/DefaultMarkdown.php php-twig-2.14.3/extra/markdown-extra/src/DefaultMarkdown.php --- php-twig-2.14.1/extra/markdown-extra/src/DefaultMarkdown.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/src/DefaultMarkdown.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -converter = new ErusevMarkdown(); - } elseif (class_exists(CommonMarkConverter::class)) { - $this->converter = new LeagueMarkdown(); - } elseif (class_exists(MarkdownExtra::class)) { - $this->converter = new MichelfMarkdown(); - } else { - throw new \LogicException('You cannot use the "markdown_to_html" filter as no Markdown library is available; try running "composer require erusev/parsedown".'); - } - } - - public function convert(string $body): string - { - return $this->converter->convert($body); - } -} diff -Nru php-twig-2.14.1/extra/markdown-extra/src/ErusevMarkdown.php php-twig-2.14.3/extra/markdown-extra/src/ErusevMarkdown.php --- php-twig-2.14.1/extra/markdown-extra/src/ErusevMarkdown.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/src/ErusevMarkdown.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -converter = $converter ?: new Parsedown(); - } - - public function convert(string $body): string - { - return $this->converter->text($body); - } -} diff -Nru php-twig-2.14.1/extra/markdown-extra/src/LeagueMarkdown.php php-twig-2.14.3/extra/markdown-extra/src/LeagueMarkdown.php --- php-twig-2.14.1/extra/markdown-extra/src/LeagueMarkdown.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/src/LeagueMarkdown.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -converter = $converter ?: new CommonMarkConverter(); - } - - public function convert(string $body): string - { - return $this->converter->convertToHtml($body); - } -} diff -Nru php-twig-2.14.1/extra/markdown-extra/src/MarkdownExtension.php php-twig-2.14.3/extra/markdown-extra/src/MarkdownExtension.php --- php-twig-2.14.1/extra/markdown-extra/src/MarkdownExtension.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/src/MarkdownExtension.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ - ['all']]), - new TwigFilter('html_to_markdown', 'Twig\\Extra\\Markdown\\twig_html_to_markdown', ['is_safe' => ['all']]), - ]; - } -} - -function twig_html_to_markdown(string $body, array $options = []): string -{ - static $converters; - - if (!class_exists(HtmlConverter::class)) { - throw new \LogicException('You cannot use the "html_to_markdown" filter as league/html-to-markdown is not installed; try running "composer require league/html-to-markdown".'); - } - - $options = $options + [ - 'hard_break' => true, - 'strip_tags' => true, - 'remove_nodes' => 'head style', - ]; - - if (!isset($converters[$key = serialize($options)])) { - $converters[$key] = new HtmlConverter($options); - } - - return $converters[$key]->convert($body); -} diff -Nru php-twig-2.14.1/extra/markdown-extra/src/MarkdownInterface.php php-twig-2.14.3/extra/markdown-extra/src/MarkdownInterface.php --- php-twig-2.14.1/extra/markdown-extra/src/MarkdownInterface.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/src/MarkdownInterface.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -converter = $converter; - } - - public function convert(string $body): string - { - // remove indentation - if ($white = substr($body, 0, strspn($body, " \t\r\n\0\x0B"))) { - $body = preg_replace("{^$white}m", '', $body); - } - - return $this->converter->convert($body); - } -} diff -Nru php-twig-2.14.1/extra/markdown-extra/src/MichelfMarkdown.php php-twig-2.14.3/extra/markdown-extra/src/MichelfMarkdown.php --- php-twig-2.14.1/extra/markdown-extra/src/MichelfMarkdown.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/src/MichelfMarkdown.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -hard_wrap = true; - } - - $this->converter = $converter; - } - - public function convert(string $body): string - { - return $this->converter->transform($body); - } -} diff -Nru php-twig-2.14.1/extra/markdown-extra/tests/Fixtures/html_to_markdown.test php-twig-2.14.3/extra/markdown-extra/tests/Fixtures/html_to_markdown.test --- php-twig-2.14.1/extra/markdown-extra/tests/Fixtures/html_to_markdown.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/tests/Fixtures/html_to_markdown.test 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ ---TEST-- -"html_to_markdown" filter ---TEMPLATE-- -{% apply html_to_markdown %} - -

    Hello

    -

    Great!

    - -{% endapply %} - - -{% apply html_to_markdown({hard_break: false}) %} - Great
    Break -{% endapply %} - - -{{ include('html')|html_to_markdown }} ---TEMPLATE(html)-- - -

    Hello

    -

    Great!

    - ---DATA-- -return [] ---EXPECT-- -Hello -===== - -**Great!** - -Great -Break - -Hello -===== - -**Great!** diff -Nru php-twig-2.14.1/extra/markdown-extra/tests/FunctionalTest.php php-twig-2.14.3/extra/markdown-extra/tests/FunctionalTest.php --- php-twig-2.14.1/extra/markdown-extra/tests/FunctionalTest.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/tests/FunctionalTest.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ - $template, - 'html' => <<addExtension(new MarkdownExtension()); - $twig->addRuntimeLoader(new class($class) implements RuntimeLoaderInterface { - private $class; - - public function __construct(string $class) - { - $this->class = $class; - } - - public function load($c) - { - if (MarkdownRuntime::class === $c) { - return new $c(new $this->class()); - } - } - }); - $this->assertMatchesRegularExpression('{'.$expected.'}m', trim($twig->render('index'))); - } - } - - public function getMarkdownTests() - { - return [ - [<<Hello\n+

    Great!

    "], - [<<Hello\n+

    Great!

    "], - ["{{ include('html')|markdown_to_html }}", "

    Hello

    \n+

    Great!

    "], - ]; - } -} diff -Nru php-twig-2.14.1/extra/markdown-extra/tests/IntegrationTest.php php-twig-2.14.3/extra/markdown-extra/tests/IntegrationTest.php --- php-twig-2.14.1/extra/markdown-extra/tests/IntegrationTest.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/tests/IntegrationTest.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ - +

    Hello

    +

    Great!

    + +{% endapply %} + + +{% apply html_to_markdown({hard_break: false}) %} + Great
    Break +{% endapply %} + + +{{ include('html')|html_to_markdown }} +--TEMPLATE(html)-- + +

    Hello

    +

    Great!

    + +--DATA-- +return [] +--EXPECT-- +Hello +===== + +**Great!** + +Great +Break + +Hello +===== + +**Great!** diff -Nru php-twig-2.14.1/extra/markdown-extra/Tests/FunctionalTest.php php-twig-2.14.3/extra/markdown-extra/Tests/FunctionalTest.php --- php-twig-2.14.1/extra/markdown-extra/Tests/FunctionalTest.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/Tests/FunctionalTest.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,86 @@ + $template, + 'html' => <<addExtension(new MarkdownExtension()); + $twig->addRuntimeLoader(new class($class) implements RuntimeLoaderInterface { + private $class; + + public function __construct(string $class) + { + $this->class = $class; + } + + public function load($c) + { + if (MarkdownRuntime::class === $c) { + return new $c(new $this->class()); + } + } + }); + $this->assertMatchesRegularExpression('{'.$expected.'}m', trim($twig->render('index'))); + } + } + + public function getMarkdownTests() + { + return [ + [<<Hello\n+

    Great!

    "], + [<<Hello\n+

    Great!

    "], + ["{{ include('html')|markdown_to_html }}", "

    Hello

    \n+

    Great!

    "], + ]; + } +} diff -Nru php-twig-2.14.1/extra/markdown-extra/Tests/IntegrationTest.php php-twig-2.14.3/extra/markdown-extra/Tests/IntegrationTest.php --- php-twig-2.14.1/extra/markdown-extra/Tests/IntegrationTest.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/markdown-extra/Tests/IntegrationTest.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,30 @@ + - ./tests/ + ./Tests/ @@ -22,7 +22,7 @@ ./ - ./tests + ./Tests ./vendor diff -Nru php-twig-2.14.1/extra/string-extra/src/StringExtension.php php-twig-2.14.3/extra/string-extra/src/StringExtension.php --- php-twig-2.14.1/extra/string-extra/src/StringExtension.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/string-extra/src/StringExtension.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ - + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Twig\Extra\TwigExtraBundle\DependencyInjection\Compiler; + +use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; +use Symfony\Component\DependencyInjection\Reference; + +class MissingExtensionSuggestorPass implements CompilerPassInterface +{ + public function process(ContainerBuilder $container) + { + if ($container->getParameter('kernel.debug')) { + $container->getDefinition('twig') + ->addMethodCall('registerUndefinedFilterCallback', [[new Reference('twig.missing_extension_suggestor'), 'suggestFilter']]) + ->addMethodCall('registerUndefinedFunctionCallback', [[new Reference('twig.missing_extension_suggestor'), 'suggestFunction']]) + ; + } + } +} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/DependencyInjection/Configuration.php php-twig-2.14.3/extra/twig-extra-bundle/DependencyInjection/Configuration.php --- php-twig-2.14.1/extra/twig-extra-bundle/DependencyInjection/Configuration.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/DependencyInjection/Configuration.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,37 @@ +getRootNode(); + + foreach (Extensions::getClasses() as $name => $class) { + $rootNode + ->children() + ->arrayNode($name) + ->{class_exists($class) ? 'canBeDisabled' : 'canBeEnabled'}() + ->end() + ->end() + ; + } + + return $treeBuilder; + } +} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/DependencyInjection/TwigExtraExtension.php php-twig-2.14.3/extra/twig-extra-bundle/DependencyInjection/TwigExtraExtension.php --- php-twig-2.14.1/extra/twig-extra-bundle/DependencyInjection/TwigExtraExtension.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/DependencyInjection/TwigExtraExtension.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,41 @@ + + */ +class TwigExtraExtension extends Extension +{ + public function load(array $configs, ContainerBuilder $container) + { + $loader = new PhpFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config')); + $configuration = $this->getConfiguration($configs, $container); + $config = $this->processConfiguration($configuration, $configs); + + if ($container->getParameter('kernel.debug')) { + $loader->load('suggestor.php'); + } + + foreach (array_keys(Extensions::getClasses()) as $extension) { + if ($this->isConfigEnabled($container, $config[$extension])) { + $loader->load($extension.'.php'); + } + } + } +} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Extensions.php php-twig-2.14.3/extra/twig-extra-bundle/Extensions.php --- php-twig-2.14.1/extra/twig-extra-bundle/Extensions.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Extensions.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,104 @@ + [ + 'name' => 'html', + 'class' => HtmlExtension::class, + 'class_name' => 'HtmlExtension', + 'package' => 'twig/html-extra', + 'filters' => ['data_uri'], + 'functions' => ['html_classes'], + ], + 'markdown' => [ + 'name' => 'markdown', + 'class' => MarkdownExtension::class, + 'class_name' => 'MarkdownExtension', + 'package' => 'twig/markdown-extra', + 'filters' => ['html_to_markdown', 'markdown_to_html'], + 'functions' => [], + ], + 'intl' => [ + 'name' => 'intl', + 'class' => IntlExtension::class, + 'class_name' => 'IntlExtension', + 'package' => 'twig/intl-extra', + 'filters' => ['country_name', 'currency_name', 'currency_symbol', 'language_name', 'locale_name', 'timezone_name', + 'format_currency', 'format_number', 'format_decimal_number', 'format_currency_number', + 'format_percent_number', 'format_scientific_number', 'format_spellout_number', 'format_ordinal_number', + 'format_duration_number', 'format_date', 'format_datetime', 'format_time', + ], + 'functions' => ['country_timezones'], + ], + 'cssinliner' => [ + 'name' => 'cssinliner', + 'class' => CssInlinerExtension::class, + 'class_name' => 'CssInlinerExtension', + 'package' => 'twig/cssinliner-extra', + 'filters' => ['inline_css'], + 'functions' => [], + ], + 'inky' => [ + 'name' => 'inky', + 'class' => InkyExtension::class, + 'class_name' => 'InkyExtension', + 'package' => 'twig/inky-extra', + 'filters' => ['inky_to_html'], + 'functions' => [], + ], + 'string' => [ + 'name' => 'string', + 'class' => StringExtension::class, + 'class_name' => 'StringExtension', + 'package' => 'twig/string-extra', + 'filters' => ['u'], + 'functions' => [], + ], + ]; + + public static function getClasses(): array + { + return array_column(self::EXTENSIONS, 'class', 'name'); + } + + public static function getFilter(string $name): array + { + foreach (self::EXTENSIONS as $extension) { + if (\in_array($name, $extension['filters'])) { + return [$extension['class_name'], $extension['package']]; + } + } + + return []; + } + + public static function getFunction(string $name): array + { + foreach (self::EXTENSIONS as $extension) { + if (\in_array($name, $extension['functions'])) { + return [$extension['class_name'], $extension['package']]; + } + } + + return []; + } +} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/LICENSE php-twig-2.14.3/extra/twig-extra-bundle/LICENSE --- php-twig-2.14.1/extra/twig-extra-bundle/LICENSE 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/LICENSE 2021-01-07 21:35:24.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright (c) 2019-2020 Fabien Potencier +Copyright (c) 2019-2021 Fabien Potencier Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/MissingExtensionSuggestor.php php-twig-2.14.3/extra/twig-extra-bundle/MissingExtensionSuggestor.php --- php-twig-2.14.1/extra/twig-extra-bundle/MissingExtensionSuggestor.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/MissingExtensionSuggestor.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,35 @@ + - ./tests/ + ./Tests/ - ./src/ + ./ + + ./Tests + ./vendor + diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/cssinliner.php php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/cssinliner.php --- php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/cssinliner.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/cssinliner.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,21 @@ +services() + ->set('twig.extension.cssinliner', CssInlinerExtension::class) + ->tag('twig.extension') + ; +}; diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/html.php php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/html.php --- php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/html.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/html.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,21 @@ +services() + ->set('twig.extension.html', HtmlExtension::class) + ->tag('twig.extension') + ; +}; diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/inky.php php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/inky.php --- php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/inky.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/inky.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,21 @@ +services() + ->set('twig.extension.inky', InkyExtension::class) + ->tag('twig.extension') + ; +}; diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/intl.php php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/intl.php --- php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/intl.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/intl.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,21 @@ +services() + ->set('twig.extension.intl', IntlExtension::class) + ->tag('twig.extension') + ; +}; diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/markdown.php php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/markdown.php --- php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/markdown.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/markdown.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,32 @@ +services() + ->set('twig.extension.markdown', MarkdownExtension::class) + ->tag('twig.extension') + + ->set('twig.runtime.markdown', MarkdownRuntime::class) + ->args([ + $service('twig.markdown.default'), + ]) + ->tag('twig.runtime') + + ->set('twig.markdown.default', DefaultMarkdown::class) + ; +}; diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/string.php php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/string.php --- php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/string.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/string.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,21 @@ +services() + ->set('twig.extension.string', StringExtension::class) + ->tag('twig.extension') + ; +}; diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/suggestor.php php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/suggestor.php --- php-twig-2.14.1/extra/twig-extra-bundle/Resources/config/suggestor.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Resources/config/suggestor.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,20 @@ +services() + ->set('twig.missing_extension_suggestor', MissingExtensionSuggestor::class) + ; +}; diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/DependencyInjection/Compiler/MissingExtensionSuggestorPass.php php-twig-2.14.3/extra/twig-extra-bundle/src/DependencyInjection/Compiler/MissingExtensionSuggestorPass.php --- php-twig-2.14.1/extra/twig-extra-bundle/src/DependencyInjection/Compiler/MissingExtensionSuggestorPass.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/DependencyInjection/Compiler/MissingExtensionSuggestorPass.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Twig\Extra\TwigExtraBundle\DependencyInjection\Compiler; - -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; -use Symfony\Component\DependencyInjection\ContainerBuilder; -use Symfony\Component\DependencyInjection\Reference; - -class MissingExtensionSuggestorPass implements CompilerPassInterface -{ - public function process(ContainerBuilder $container) - { - if ($container->getParameter('kernel.debug')) { - $container->getDefinition('twig') - ->addMethodCall('registerUndefinedFilterCallback', [[new Reference('twig.missing_extension_suggestor'), 'suggestFilter']]) - ->addMethodCall('registerUndefinedFunctionCallback', [[new Reference('twig.missing_extension_suggestor'), 'suggestFunction']]) - ; - } - } -} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/DependencyInjection/Configuration.php php-twig-2.14.3/extra/twig-extra-bundle/src/DependencyInjection/Configuration.php --- php-twig-2.14.1/extra/twig-extra-bundle/src/DependencyInjection/Configuration.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/DependencyInjection/Configuration.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -getRootNode(); - - foreach (Extensions::getClasses() as $name => $class) { - $rootNode - ->children() - ->arrayNode($name) - ->{class_exists($class) ? 'canBeDisabled' : 'canBeEnabled'}() - ->end() - ->end() - ; - } - - return $treeBuilder; - } -} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/DependencyInjection/TwigExtraExtension.php php-twig-2.14.3/extra/twig-extra-bundle/src/DependencyInjection/TwigExtraExtension.php --- php-twig-2.14.1/extra/twig-extra-bundle/src/DependencyInjection/TwigExtraExtension.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/DependencyInjection/TwigExtraExtension.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ - - */ -class TwigExtraExtension extends Extension -{ - public function load(array $configs, ContainerBuilder $container) - { - $loader = new XmlFileLoader($container, new FileLocator(\dirname(__DIR__).'/Resources/config')); - $configuration = $this->getConfiguration($configs, $container); - $config = $this->processConfiguration($configuration, $configs); - - if ($container->getParameter('kernel.debug')) { - $loader->load('suggestor.xml'); - } - - foreach (array_keys(Extensions::getClasses()) as $extension) { - if ($this->isConfigEnabled($container, $config[$extension])) { - $loader->load($extension.'.xml'); - } - } - } -} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/Extensions.php php-twig-2.14.3/extra/twig-extra-bundle/src/Extensions.php --- php-twig-2.14.1/extra/twig-extra-bundle/src/Extensions.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/Extensions.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ - [ - 'name' => 'html', - 'class' => HtmlExtension::class, - 'class_name' => 'HtmlExtension', - 'package' => 'twig/html-extra', - 'filters' => ['data_uri'], - 'functions' => ['html_classes'], - ], - 'markdown' => [ - 'name' => 'markdown', - 'class' => MarkdownExtension::class, - 'class_name' => 'MarkdownExtension', - 'package' => 'twig/markdown-extra', - 'filters' => ['html_to_markdown', 'markdown_to_html'], - 'functions' => [], - ], - 'intl' => [ - 'name' => 'intl', - 'class' => IntlExtension::class, - 'class_name' => 'IntlExtension', - 'package' => 'twig/intl-extra', - 'filters' => ['country_name', 'currency_name', 'currency_symbol', 'language_name', 'locale_name', 'timezone_name', - 'format_currency', 'format_number', 'format_decimal_number', 'format_currency_number', - 'format_percent_number', 'format_scientific_number', 'format_spellout_number', 'format_ordinal_number', - 'format_duration_number', 'format_date', 'format_datetime', 'format_time', - ], - 'functions' => ['country_timezones'], - ], - 'cssinliner' => [ - 'name' => 'cssinliner', - 'class' => CssInlinerExtension::class, - 'class_name' => 'CssInlinerExtension', - 'package' => 'twig/cssinliner-extra', - 'filters' => ['inline_css'], - 'functions' => [], - ], - 'inky' => [ - 'name' => 'inky', - 'class' => InkyExtension::class, - 'class_name' => 'InkyExtension', - 'package' => 'twig/inky-extra', - 'filters' => ['inky_to_html'], - 'functions' => [], - ], - 'string' => [ - 'name' => 'string', - 'class' => StringExtension::class, - 'class_name' => 'StringExtension', - 'package' => 'twig/string-extra', - 'filters' => ['u'], - 'functions' => [], - ], - ]; - - public static function getClasses(): array - { - return array_column(self::EXTENSIONS, 'class', 'name'); - } - - public static function getFilter(string $name): array - { - foreach (self::EXTENSIONS as $extension) { - if (\in_array($name, $extension['filters'])) { - return [$extension['class_name'], $extension['package']]; - } - } - - return []; - } - - public static function getFunction(string $name): array - { - foreach (self::EXTENSIONS as $extension) { - if (\in_array($name, $extension['functions'])) { - return [$extension['class_name'], $extension['package']]; - } - } - - return []; - } -} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/MissingExtensionSuggestor.php php-twig-2.14.3/extra/twig-extra-bundle/src/MissingExtensionSuggestor.php --- php-twig-2.14.1/extra/twig-extra-bundle/src/MissingExtensionSuggestor.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/MissingExtensionSuggestor.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ - - - - - - - - - - - - diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/html.xml php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/html.xml --- php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/html.xml 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/html.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/inky.xml php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/inky.xml --- php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/inky.xml 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/inky.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/intl.xml php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/intl.xml --- php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/intl.xml 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/intl.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/markdown.xml php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/markdown.xml --- php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/markdown.xml 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/markdown.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/string.xml php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/string.xml --- php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/string.xml 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/string.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ - - - - - - - - - - - - diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/suggestor.xml php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/suggestor.xml --- php-twig-2.14.1/extra/twig-extra-bundle/src/Resources/config/suggestor.xml 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/Resources/config/suggestor.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ - - - - - - - - - - diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/src/TwigExtraBundle.php php-twig-2.14.3/extra/twig-extra-bundle/src/TwigExtraBundle.php --- php-twig-2.14.1/extra/twig-extra-bundle/src/TwigExtraBundle.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/src/TwigExtraBundle.php 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -addCompilerPass(new MissingExtensionSuggestorPass()); - } -} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/Tests/DependencyInjection/TwigExtraExtensionTest.php php-twig-2.14.3/extra/twig-extra-bundle/Tests/DependencyInjection/TwigExtraExtensionTest.php --- php-twig-2.14.1/extra/twig-extra-bundle/Tests/DependencyInjection/TwigExtraExtensionTest.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/Tests/DependencyInjection/TwigExtraExtensionTest.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,38 @@ + false, + ])); + $container->registerExtension(new TwigExtraExtension()); + $container->loadFromExtension('twig_extra'); + $container->getCompilerPassConfig()->setOptimizationPasses([]); + $container->getCompilerPassConfig()->setRemovingPasses([]); + $container->getCompilerPassConfig()->setAfterRemovingPasses([]); + $container->compile(); + + foreach (Extensions::getClasses() as $name => $class) { + $this->assertEquals($class, $container->getDefinition('twig.extension.'.$name)->getClass()); + } + } +} diff -Nru php-twig-2.14.1/extra/twig-extra-bundle/TwigExtraBundle.php php-twig-2.14.3/extra/twig-extra-bundle/TwigExtraBundle.php --- php-twig-2.14.1/extra/twig-extra-bundle/TwigExtraBundle.php 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/extra/twig-extra-bundle/TwigExtraBundle.php 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,26 @@ +addCompilerPass(new MissingExtensionSuggestorPass()); + } +} diff -Nru php-twig-2.14.1/.github/workflows/ci.yml php-twig-2.14.3/.github/workflows/ci.yml --- php-twig-2.14.1/.github/workflows/ci.yml 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/.github/workflows/ci.yml 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,166 @@ +name: "CI" + +on: + pull_request: + push: + branches: + - '2.x' + +env: + SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE: 1 + +jobs: + tests: + name: "PHP ${{ matrix.php-version }}" + + runs-on: 'ubuntu-latest' + + continue-on-error: true + + strategy: + matrix: + php-version: + - '7.2.5' + - '7.3' + - '7.4' + - '8.0' + + steps: + - name: "Checkout code" + uses: actions/checkout@v2.3.3 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@2.7.0 + with: + coverage: "none" + php-version: ${{ matrix.php-version }} + ini-values: memory_limit=-1 + tools: composer:v2 + + - name: "Add PHPUnit matcher" + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: "Set composer cache directory" + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: "Cache composer" + uses: actions/cache@v2.1.2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php-version }}-composer-${{ hashFiles('composer.json') }} + restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-composer- + + - run: composer install + + - name: "Install PHPUnit" + run: vendor/bin/simple-phpunit install + + - name: "PHPUnit version" + run: vendor/bin/simple-phpunit --version + + - name: "Run tests" + run: vendor/bin/simple-phpunit + + extension-tests: + needs: + - 'tests' + + name: "${{ matrix.extension }} with PHP ${{ matrix.php-version }}" + + runs-on: 'ubuntu-latest' + + continue-on-error: true + + strategy: + matrix: + php-version: + - '7.2.5' + - '7.3' + - '7.4' + - '8.0' + extension: + - 'extra/cssinliner-extra' + - 'extra/html-extra' + - 'extra/inky-extra' + - 'extra/intl-extra' + - 'extra/markdown-extra' + - 'extra/string-extra' + - 'extra/twig-extra-bundle' + + steps: + - name: "Checkout code" + uses: actions/checkout@v2.3.3 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@2.7.0 + with: + coverage: "none" + php-version: ${{ matrix.php-version }} + ini-values: memory_limit=-1 + tools: composer:v2 + + - name: "Add PHPUnit matcher" + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: "Set composer cache directory" + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: "Cache composer" + uses: actions/cache@v2.1.2 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.extension }}-${{ hashFiles('composer.json') }} + restore-keys: ${{ runner.os }}-${{ matrix.php-version }}-${{ matrix.extension }}- + + - run: composer install + + - name: "Install PHPUnit" + run: vendor/bin/simple-phpunit install + + - name: "PHPUnit version" + run: vendor/bin/simple-phpunit --version + + - if: matrix.extension == 'extra/markdown-extra' && matrix.php-version == '8.0' + working-directory: ${{ matrix.extension}} + run: composer config platform.php 7.4.99 + + - name: "Composer install" + working-directory: ${{ matrix.extension}} + run: composer install + + - name: "Run tests" + working-directory: ${{ matrix.extension}} + run: ../../vendor/bin/simple-phpunit + + integration-tests: + needs: + - 'tests' + + name: "Integration tests with PHP ${{ matrix.php-version }}" + + runs-on: 'ubuntu-20.04' + + continue-on-error: true + + strategy: + matrix: + php-version: + - '7.3' + + steps: + - name: "Checkout code" + uses: actions/checkout@v2.3.3 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@2.7.0 + with: + coverage: "none" + extensions: "gd, pdo_sqlite" + php-version: ${{ matrix.php-version }} + ini-values: memory_limit=-1 + tools: composer:v2 + + - run: ./drupal_test.sh + shell: "bash" diff -Nru php-twig-2.14.1/.github/workflows/documentation.yml php-twig-2.14.3/.github/workflows/documentation.yml --- php-twig-2.14.1/.github/workflows/documentation.yml 1970-01-01 00:00:00.000000000 +0000 +++ php-twig-2.14.3/.github/workflows/documentation.yml 2021-01-07 21:35:24.000000000 +0000 @@ -0,0 +1,60 @@ +name: "Documentation" + +on: + pull_request: + push: + branches: + - '1.x' + +jobs: + build: + name: "Build" + + runs-on: ubuntu-latest + + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + + - name: "Set up Python 3.7" + uses: actions/setup-python@v1 + with: + python-version: '3.7' # Semantic version range syntax or exact version of a Python version + + - name: "Display Python version" + run: python -c "import sys; print(sys.version)" + + - name: "Install Sphinx dependencies" + run: sudo apt-get install python-dev build-essential + + - name: "Cache pip" + uses: actions/cache@v2 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('_build/.requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + + - name: "Install Sphinx + requirements via pip" + working-directory: "doc" + run: pip install -r _build/.requirements.txt + + - name: "Build documentation" + working-directory: "doc" + run: make -C _build SPHINXOPTS="-nqW -j auto" html + + doctor-rst: + name: "DOCtor-RST" + + runs-on: ubuntu-latest + + steps: + - name: "Checkout code" + uses: actions/checkout@v2 + + - name: "Run DOCtor-RST" + uses: docker://oskarstark/doctor-rst + with: + args: --short + env: + DOCS_DIR: 'doc/' diff -Nru php-twig-2.14.1/LICENSE php-twig-2.14.3/LICENSE --- php-twig-2.14.1/LICENSE 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/LICENSE 2021-01-07 21:35:24.000000000 +0000 @@ -1,4 +1,4 @@ -Copyright (c) 2009-2020 by the Twig Team. +Copyright (c) 2009-2021 by the Twig Team. All rights reserved. diff -Nru php-twig-2.14.1/src/Environment.php php-twig-2.14.3/src/Environment.php --- php-twig-2.14.1/src/Environment.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/src/Environment.php 2021-01-07 21:35:24.000000000 +0000 @@ -38,11 +38,11 @@ */ class Environment { - const VERSION = '2.14.1'; - const VERSION_ID = 21401; + const VERSION = '2.14.3'; + const VERSION_ID = 21403; const MAJOR_VERSION = 2; const MINOR_VERSION = 14; - const RELEASE_VERSION = 1; + const RELEASE_VERSION = 3; const EXTRA_VERSION = ''; private $charset; diff -Nru php-twig-2.14.1/src/Node/Expression/Test/OddTest.php php-twig-2.14.3/src/Node/Expression/Test/OddTest.php --- php-twig-2.14.1/src/Node/Expression/Test/OddTest.php 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/src/Node/Expression/Test/OddTest.php 2021-01-07 21:35:24.000000000 +0000 @@ -28,7 +28,7 @@ $compiler ->raw('(') ->subcompile($this->getNode('node')) - ->raw(' % 2 == 1') + ->raw(' % 2 != 0') ->raw(')') ; } diff -Nru php-twig-2.14.1/tests/Fixtures/tests/odd.test php-twig-2.14.3/tests/Fixtures/tests/odd.test --- php-twig-2.14.1/tests/Fixtures/tests/odd.test 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/tests/Fixtures/tests/odd.test 2021-01-07 21:35:24.000000000 +0000 @@ -3,8 +3,10 @@ --TEMPLATE-- {{ 1 is odd ? 'ok' : 'ko' }} {{ 2 is odd ? 'ko' : 'ok' }} +{{ -1 is odd ? 'ok' : 'ko' }} --DATA-- return [] --EXPECT-- ok +ok ok \ No newline at end of file diff -Nru php-twig-2.14.1/.travis.yml php-twig-2.14.3/.travis.yml --- php-twig-2.14.1/.travis.yml 2020-11-21 19:34:32.000000000 +0000 +++ php-twig-2.14.3/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -language: php - -dist: xenial - -cache: - directories: - - vendor - - extra/*/vendor - - $HOME/.composer/cache/files - -env: - global: - - SYMFONY_PHPUNIT_DISABLE_RESULT_CACHE=1 - -before_install: - - phpenv config-rm xdebug.ini || return 0 - - echo memory_limit = -1 >> ~/.phpenv/versions/$TRAVIS_PHP_VERSION/etc/conf.d/travis.ini - -install: - - travis_retry composer install - - export PHPUNIT=$(readlink -f ./vendor/bin/simple-phpunit) - - $PHPUNIT install - - (cd extra/cssinliner-extra && travis_retry composer install) - - (cd extra/html-extra && travis_retry composer install) - - (cd extra/inky-extra && travis_retry composer install) - - (cd extra/intl-extra && travis_retry composer install) - - ([[ $TRAVIS_PHP_VERSION = nightly ]] && (cd extra/markdown-extra && composer config platform.php 7.4.99) || true) - - (cd extra/markdown-extra && travis_retry composer install) - - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || (cd extra/string-extra && travis_retry composer install)) - -script: - - $PHPUNIT - - (cd extra/cssinliner-extra && $PHPUNIT) - - (cd extra/html-extra && $PHPUNIT) - - (cd extra/inky-extra && $PHPUNIT) - - (cd extra/intl-extra && $PHPUNIT) - - (cd extra/markdown-extra && $PHPUNIT) - - ([[ $TRAVIS_PHP_VERSION = 7.1 ]] || (cd extra/string-extra && $PHPUNIT)) - -jobs: - fast_finish: true - include: - - php: 7.2 - - php: 7.3 - - php: 7.4 - - php: nightly - - stage: integration tests - php: 7.3 - script: ./drupal_test.sh