it-blaster/typograph-bundle

基于 E. Muravjev's Typograph 的 Symfony 扩展包

v1.0.3 2015-08-25 07:07 UTC

This package is not auto-updated.

Last update: 2024-09-14 16:50:17 UTC


README

Scrutinizer Code Quality Build Status License Total Downloads Latest Unstable Version Latest Stable Version

基于 E. Muravjev's Typograph 的 Symfony 扩展包

安装

将 it-blaster/typograph-bundle 添加到您的 composer.json 文件并运行 composer

...
"require": {
    "it-blaster/typograph-bundle": "1.0.*"
}
...

并在您的 AppKernel.php 中注册该扩展包

...
new Fenrizbes\TypographBundle\FenrizbesTypographBundle(),
...

用法

该扩展包包含一个 TwigExtension,可用于模板中

{{ content | typograph }}

配置

该扩展包允许您传递 E. Muravjev's Typograph 支持的选项。您可以使用默认配置,重新定义它

fenrizbes_typograph:
    configs:
        default:
            Text.paragraphs:           on
            OptAlign.oa_oquote:        off
            OptAlign.oa_obracket_coma: off

或定义您自己的配置

fenrizbes_typograph:
    configs:
        default:
            Text.paragraphs:           off
            OptAlign.oa_oquote:        off
            OptAlign.oa_obracket_coma: off
        articles:
            Text.paragraphs: on
        news:
            Text.paragraphs: off

并在需要的地方使用它们

{{ article.content | typograph('articles') }}