38 Commits

Author SHA1 Message Date
Fabien Potencier 44eb4242ad Merge branch '3.x' into 4.x
* 3.x:
  Resolve block chains against the render context instead of freezing lineages
  Resolve constant parent templates once instead of on every lookup
  Template runtime and block composition
  Fix wrapping the Twig cache pool in a second tag aware adapter
  Check that the use tag is allowed before resolving trait templates

# Conflicts:
#	CHANGELOG
#	extra/twig-extra-bundle/TwigExtraBundle.php
#	src/Template.php
2026-09-12 09:57:39 +02:00
Nicolas Grekas bd939c8c3a Fix wrapping the Twig cache pool in a second tag aware adapter
The ".twig.cache.inner" pool is a child of "cache.app". When the application
configures a natively tag aware adapter for it (redis, valkey, pdo or mongodb),
the child pool is already tag aware and decorating it with a TagAwareAdapter
turns every read into a miss.

Alias "twig.cache" to the pool in that case, the way Symfony aliases
"cache.app.taggable" to "cache.app" instead of decorating it. The pool keeps
its own namespace, so it does not start sharing the application pool's one, and
the decorator stays in place for the plain adapters that need it.
2026-09-11 10:59:50 +02:00
Fabien Potencier 6bbbb49c3e Restore void return type compatibility for extension points 2026-08-27 07:27:31 +02:00
Fabien Potencier 9c6d76b61c Add void return type hint even in tests 2026-07-12 13:43:08 +02:00
Fabien Potencier 861215c507 Fix CS 2026-02-07 09:07:38 +01:00
Nicolas Grekas c649c1658b Merge branch '3.x' into 4.x
* 3.x:
  CS fixes
  Enable Fabbot as a GHA
2025-07-29 10:27:55 +02:00
Nicolas Grekas c2b04ec6d9 Merge branch '3.x' into 4.x
* 3.x:
  Escaper performance: avoid static variables
  Fix compatibility with Symfony 8
  Add documentation for use_yield option
  Stof suggestion about empty content
  Update templates.rst: Removing duplication
  Update configuration keys + allow extra keys for extensions
  replace typographic quote with straigt single quote
  Add TwigCsFixer in tools list
  Update reduce.rst
  Bump version
  Prepare the 3.21.1 release
  Update CHANGELOG
  Fix warning
  Fix instantiation
2025-07-29 10:22:22 +02:00
Nicolas Grekas fec73458dc minor #4664 CS fixes (nicolas-grekas)
This PR was merged into the 3.x branch.

Discussion
----------

CS fixes

Commits
-------

85a4817128 CS fixes
2025-07-29 10:10:06 +02:00
Nicolas Grekas 85a4817128 CS fixes 2025-07-29 10:07:07 +02:00
Nicolas Grekas b6a105c952 Fix compatibility with Symfony 8 2025-07-10 12:07:05 +02:00
Doeke Norg a8aadc3e99 Update configuration keys + allow extra keys for extensions 2025-05-23 09:29:36 +02:00
Fabien Potencier 38c52534cc Merge branch '3.x' into 4.x
* 3.x:
  Fix CS
2025-02-14 13:02:29 +01:00
Fabien Potencier 151aa4ecda Fix CS 2025-02-14 12:57:03 +01:00
Fabien Potencier c142a3268e Merge branch '3.x' into 4.x
* 3.x:
  Fix CHANGELOG
  Fix support for ignoring syntax erros in an undefined handler in guard
  Add missing CHANGELOG
  Fix timezone conversion on strings
  Use correct lineno for ForElseNode
  Add support for registered undefined element callbacks in tests
  Add UnaryInterface
  Add BinaryInterface
  Reimplement the cache tag in an adhoc way
  Fix CS
  Fix wrong array index
  Fix wrong array index
  Bump min PHP version to 8.1
  Add even more tests
  Add some tests on balanced brackets
  Bump version
  Prepare the 3.19.0 release
  Added configuration for commonmark use in twig-extra-bundle.
2025-02-09 18:23:27 +01:00
Fabien Potencier 3cdf26fe76 feature #3737 Added configuration for commonmark use in twig-extra-bundle. (doekenorg)
This PR was merged into the 3.x branch.

Discussion
----------

Added configuration for commonmark use in twig-extra-bundle.

Following this tweet: https://twitter.com/ramsey/status/1561894460560138241, this PR adds the configuration options for `commonmark` to the `twig-extra-bundle`.

The configuration is added to the `LeagueCommonMarkConverterFactory` and in turn injected in the `CommonMarkConverter`. This way a user can provide the configuration for usage inside twig.

I'm not sure if adding the configuration inside the extension is the way to go.

Hope this helps out at least `@ramsey` :-)

Added `ignoreExtraKeys` to be somewhat future proof in case extra configuration is added later on, and also to be able to provide de configuration for extensions.

Commits
-------

6f20629622 Added configuration for commonmark use in twig-extra-bundle.
2025-02-08 10:44:24 +01:00
Fabien Potencier 0c6bd47d6b Merge branch '3.x' into 4.x
* 3.x:
  Deprecate using Node directly, introduce EmptyNode and Nodes
  Add support for inline comments
  Update plural.rst: Fixing(?) broken links
  Fix CS
  Add support for accessing class constants with the dot operator
  Fix getting a property on an object casted to an array
  Replace strtr() by strtolower()
  Improve escape deprecation message
  Remove useless assign in compiled code
  Add fixture filename as key
  Be more precise about double-escaping
  Fix template name in error for an unknown dynamic extends called from an include
2024-09-27 07:59:52 +02:00
Fabien Potencier a23cd9feeb Fix CS 2024-09-26 21:22:23 +02:00
Fabien Potencier 9b9196c9d6 Merge branch '3.x' into 4.x
* 3.x:
  Deprecate the sandbox tag
  Removed @internal on Environment::getGlobals()
  Clarify docs on registerUndefinedTokenParserCallback()
  Simplify code
2024-09-10 22:43:00 +02:00
Fabien Potencier a240eff47e Simplify code 2024-09-10 08:27:46 +02:00
Simon André 470965fcc2 Add missing return types in 4.0 2024-08-17 23:10:07 +02:00
Christian Flothmann b61a422493 change extended DI extension class 2024-04-18 11:24:21 +02:00
Fabien Potencier 5193653ecb Fix CS 2023-10-08 09:05:22 +02:00
Fabien Potencier 2e0286630e Merge branch '2.x' into 3.x
* 2.x:
  Fix BC break
  Update Drupal version in tests
  Fix code
  Bump PHP version used by Drupal tests
  add return type for Symfony 7 compatibility
2023-07-29 13:21:17 +02:00
Fabien Potencier 244d5de454 Fix BC break 2023-07-29 13:21:11 +02:00
Fabien Potencier 64543c3c49 Fix code 2023-07-28 12:18:03 +02:00
Christian Flothmann fac08ec7d3 add return type for Symfony 7 compatibility 2023-07-27 11:30:49 +02:00
Phil E. Taylor 72d6f20556 suppress native return type deprecation msg 2023-05-06 12:11:46 +01:00
Doeke Norg 6f20629622 Added configuration for commonmark use in twig-extra-bundle. 2022-08-23 21:10:06 +02:00
Kevin Bond ed10609688 [bug] only use Commonmark extensions if markdown enabled 2022-01-03 08:59:31 -05:00
Fabien Potencier 3cefebac2b feature #3559 Allow CommonMark extensions to easily be added (kbond)
This PR was squashed before being merged into the 3.x branch.

Discussion
----------

Allow CommonMark extensions to easily be added

1. I discovered that commonmark 2 works just fine with `markdown-extra` so I added to the `require-dev` of `markdown-extra`'s `composer.json`
2. Added `LeagueMarkdownFactory` to `markdown-extra` as discussed in #3558
3. In `twig-extra-bundle`, if commonmark (and the above factory) is available, wire up the factory with extensions added via the `twig.markdown.league_extension` DI tag

If this PR would be acceptable, I can add some tests.

(closes #3558)

Commits
-------

4b86f5ef Allow CommonMark extensions to easily be added
2022-01-02 16:32:49 +01:00
Kevin Bond 4b86f5efdc Allow CommonMark extensions to easily be added 2022-01-02 16:32:46 +01:00
Fabien Potencier 7cf279d3d6 Merge branch '2.x' into 3.x
* 2.x:
  [TwigExtraBundle] Add the return type information in getConfigTreeBuilder()
2021-11-05 17:53:41 +01:00
Javier Eguiluz 26654f653f [TwigExtraBundle] Add the return type information in getConfigTreeBuilder() 2021-11-05 16:54:01 +01:00
Ryan Weaver ef15dd3abf Allowing compat with Twig 2 by conditionally calling method 2021-02-06 16:13:17 -05:00
Fabien Potencier cb88e0a68c Merge branch '2.x' into 3.x
* 2.x:
  Move things around
2021-01-01 15:58:18 +01:00
Fabien Potencier 1868918724 Move things around 2021-01-01 15:53:48 +01:00
Yonel Ceruto f24f057a15 Revamping bundle structure to not mix source code with config files 2019-08-10 08:00:43 -04:00
Fabien Potencier 741ea46e02 added the Markdown extension 2019-08-10 11:29:35 +02:00