mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 11:27:00 +00:00
Fix inlining of sources with CRLF
This commit is contained in:
@@ -641,7 +641,7 @@ class Twig_Environment
|
||||
$compiled = $this->compile($this->parse($this->tokenize($source, $name)), $source);
|
||||
|
||||
if (isset($source[0])) {
|
||||
$compiled .= '/* '.str_replace(array("\r\n", "\r", "\n"), "*/\n/* ", str_replace('*/', '*//*', $source))."*/\n";
|
||||
$compiled .= '/* '.strtr($source, array('*/' => '*//*', "\r\n" => "*/\n/* ", "\r" => "*/\n/* ", "\n" => "*/\n/* "))."*/\n";
|
||||
}
|
||||
|
||||
return $compiled;
|
||||
|
||||
@@ -142,7 +142,7 @@ class Twig_Tests_EnvironmentTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
$twig = new Twig_Environment($this->getMock('Twig_LoaderInterface'));
|
||||
|
||||
$source = "<? /*foo*/ ?>\nbar\n";
|
||||
$source = "<? /*foo*/ ?>\r\nbar\n";
|
||||
$expected = "/* <? /*foo*//* ?>*/\n/* bar*/\n/* */\n";
|
||||
|
||||
$this->assertContains($expected, $twig->compileSource($source, 'index'));
|
||||
|
||||
Reference in New Issue
Block a user