kix/mdash-bundle

E. Muravjov 的用于 Symfony 的排版器

0.5.2 2014-11-07 08:10 UTC

This package is auto-updated.

Last update: 2024-09-14 03:10:40 UTC


README

这是一个为 E. Muravjov 的排版器而设计的 Symfony 2 扩展包,用于 E. Muravjov 的排版器

安装很简单。只需将以下行添加到您的 composer.json 文件的 require 部分

"kix/mdash-bundle": "0.5.x"

将扩展包添加到您的 AppKernel.php 文件中

<?php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = array(
            new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
            // ...
            new \Kix\MdashBundle\KixMdashBundle(),
        );

安装后,模板中将可用一个新的 mdash Twig 过滤器。它应按以下方式使用(假设 article 对象的 text 属性包含需要适当格式化的文本)

{{ article.text | mdash }}

此外,还有一个 kix_mdash.typographer 服务可用,它是 \EMT\EMTypograph 的实例。您可以从容器中请求它并以任何您喜欢的方式使用它

<?php
class SomeClass implements ContainerAwareInterface
{

    public function processText()
    {
        /** @var \EMT\EMTypograph $typographer */
        $typographer = $this->container->get('kix_mdash.typographer');
    }

}

统计数据

SensioLabsInsight

Build Status

Scrutinizer Code Quality