jolicode/jolitypo-bundle

This package is abandoned and no longer maintained. The author suggests using the jolicode/jolitypo package instead.

JoliTypo integration for your Symfony2 project

Installs: 31 855

Dependents: 0

Suggesters: 0

Security: 0

Stars: 14

Watchers: 5

Forks: 1

Open Issues: 1

Type:symfony-bundle

1.0 2016-08-10 09:25 UTC

This package is not auto-updated.

Last update: 2021-06-15 13:22:04 UTC


README

DEPRECATED: Since 1.0.3, JoliTypo provides built-in support for Symfony and Twig.

This bundle integrate the JoliTypo library into Symfony2.

Configuration

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 😬

Twig function

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 %}

PHP Template helper

A jolitypo helper is available in the view, exposing a fix method:

<?php echo $view['jolitypo']->fix('<p>Content</p>', 'en'); ?>

Todo

  • Allow to set service as Fixer via an @
  • Use Lazy services for all the presets