Exemple #1
0
function typography($html, $lang, $math)
{
    $html = Markdown($html);
    switch ($lang) {
        case '0':
            $typo = new phpTypography();
            $typo->set_smart_quotes_primary("doubleGuillemetsFrench");
            $typo->set_smart_quotes_secondary("doubleCurled");
            $typo->set_wrap_hard_hyphens(false);
            $typo->set_hyphenation(false);
            $typo->set_dewidow(false);
            //ne pas ajouter de style CSS supplémentaire
            $typo->set_style_caps(false);
            $typo->set_style_numbers(false);
            $typo->set_style_initial_quotes(false);
            $typo->set_url_wrap(false);
            $typo->set_email_wrap(false);
            $typo->set_smart_diacritics(false);
            if ($math == 'on') {
                $typo->set_smart_math(true);
            } else {
                $typo->set_smart_math(false);
            }
            $html = $typo->process($html);
            break;
        case '1':
            $typo = new phpTypography();
            $typo->set_hyphenation(false);
            $typo->set_dewidow(false);
            $typo->set_wrap_hard_hyphens(false);
            //ne pas ajouter de style CSS supplémentaire
            $typo->set_style_caps(false);
            $typo->set_style_numbers(false);
            $typo->set_style_initial_quotes(false);
            $typo->set_url_wrap(false);
            $typo->set_email_wrap(false);
            $typo->set_punctuation_spacing(false);
            if ($math == 'on') {
                $typo->set_smart_math(true);
            } else {
                $typo->set_smart_math(false);
            }
            $typo->set_dewidow(false);
            $html = $typo->process($html);
            break;
    }
    return $html;
}
function twig_typography_filter(Twig_Environment $env, $value)
{
    $lib = new phpTypography();
    $value = $lib->process($value);
    return $value;
}