[Console] Fix style escaping parsing
This commit is contained in:
parent
8ca1b805ce
commit
eb93e66aa7
@ -23,7 +23,7 @@ class OutputFormatter implements OutputFormatterInterface
|
|||||||
/**
|
/**
|
||||||
* The pattern to phrase the format.
|
* The pattern to phrase the format.
|
||||||
*/
|
*/
|
||||||
const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?:(?!\\\\?<(?:/?[a-z]|/>)).)*)#is';
|
const FORMAT_PATTERN = '#(\\\\?)<(/?)([a-z][a-z0-9_=;-]+)?>((?: [^<\\\\]+ | (?!<(?:/?[a-z]|/>)). | .(?<=\\\\<) )*)#isx';
|
||||||
|
|
||||||
private $decorated;
|
private $decorated;
|
||||||
private $styles = array();
|
private $styles = array();
|
||||||
|
@ -83,6 +83,16 @@ class FormatterStyleTest extends \PHPUnit_Framework_TestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testStyleEscaping()
|
||||||
|
{
|
||||||
|
$formatter = new OutputFormatter(true);
|
||||||
|
|
||||||
|
$this->assertEquals(
|
||||||
|
"(\033[32mz>=2.0,<a2.3\033[0m)",
|
||||||
|
$formatter->format('(<info>'.$formatter->escape('z>=2.0,<a2.3').'</info>)')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function testDeepNestedStyles()
|
public function testDeepNestedStyles()
|
||||||
{
|
{
|
||||||
$formatter = new OutputFormatter(true);
|
$formatter = new OutputFormatter(true);
|
||||||
|
Reference in New Issue
Block a user