src/Kunstmaan/GeneratorBundle/Generator/KunstmaanGenerator.php
public function renderTwig($template, array $parameters, $sourceDir)
    {
        $twig = new \Twig_Environment(
            new \Twig_Loader_Filesystem(array($sourceDir)), array(
                'debug' => true,
                'cache' => false,
                'strict_variables' => true,
                'autoescape' => false,
            )
        );

        // Ruby erb template syntax
        $lexer = new \Twig_Lexer(
            $twig, array(
                'tag_comment' => array('<%#', '%>'),
                'tag_block' => array('<%', '%>'),
                'tag_variable' => array('<%=', '%>'),
            )
        );

        $twig->setLexer($lexer);

        return $twig->render($template, $parameters);
    }
public function renderTwig($template, array $parameters, $sourceDir)
    {
        $twig = new \Twig_Environment(
            new \Twig_Loader_Filesystem(array($sourceDir)), array(
                'debug' => true,
                'cache' => false,
                'strict_variables' => true,
                'autoescape' => false,
            )
        );

        // Ruby erb template syntax
        $lexer = new \Twig_Lexer(
            $twig, array(
                'tag_comment' => array('<%#', '%>'),
                'tag_block' => array('<%', '%>'),
                'tag_variable' => array('<%=', '%>'),
            )
        );

        $twig->setLexer($lexer);

        return $twig->render($template, $parameters);
    }
public function renderTwig ( $ template , array $ parameters , $ sourceDir ) { $ twig = new \ Twig_Environment ( new \ Twig_Loader_Filesystem ( array ( $ sourceDir ) ) , array ( 'debug' => true , 'cache' => false , 'strict_variables' => true , 'autoescape' => false , ) ) ; // Ruby erb template syntax $ lexer = new \ Twig_Lexer ( $ twig , array ( 'tag_comment' => array ( '<%#' , '%>' ) , 'tag_block' => array ( '<%' , '%>' ) , 'tag_variable' => array ( '<%=' , '%>' ) , ) ) ; $ twig -> setLexer ( $ lexer ) ; return $ twig -> render ( $ template , $ parameters ) ; }
Render a twig file with custom twig tags.

@param string $template
@param array  $parameters
@param string $sourceDir

@return string
Render a twig file with custom twig tags .