DEPRECATED: Since 1.0.3, JoliTypo provides built-in support for Symfony and Twig.
This bundle integrate the JoliTypo library into Symfony2.
Add the Bundle to your Kernel:
new Joli\TypoBundle\JoliTypoBundle(),
Define your Fixers preset as you want:
joli_typo:
presets:
fr:
fixers: [ Ellipsis, Dimension, Dash, FrenchQuotes, FrenchNoBreakSpace, CurlyQuote, Trademark ]
locale: fr_FR
en:
fixers: [ Ellipsis, Dimension, Dash, EnglishQuotes, CurlyQuote, Trademark ]
locale: en_GB
Please refer to the JoliTypo documentation to learn more about fixers, and how to combine them.
Note: there is no cache involved with JoliTypo, take care of it if you want to save some CPU cycles 😬
The Bundle expose a new Twig function and filter named jolitypo
, waiting for two arguments: HTML content to fix and the preset name.
{{ jolitypo('<p>Hi folk!</p>', 'fr') | raw }}
{# or #}
{{ '<p>Hi folk!</p>' | jolitypo('fr') }}
Another way to use it is by passing a whole block to it:
{% block content %}
{{ jolitypo(block('real_content'), 'fr') | raw }}
{% endblock %}
{% block real_content %}
<h2>My whole dynamic page</h2>
{% endblock %}
A jolitypo
helper is available in the view, exposing a fix
method:
<?php echo $view['jolitypo']->fix('<p>Content</p>', 'en'); ?>
- Allow to set service as Fixer via an
@
- Use Lazy services for all the presets