public static decorateTT ( string $str ) : string | ||
$str | string | Input string. Treated as plain text. |
리턴 | string | The resulting HTML |
public static function decorateTT($str)
{
$str = htmlspecialchars($str, ENT_QUOTES);
$str = preg_replace('/`([^`]*)`/', '<tt>\\1</tt>', $str);
return $str;
}
public function testDecorateTT() { $input = 'Lorem `ipsum` dolor.'; $this->assertEquals('Lorem <tt>ipsum</tt> dolor.', Html::decorateTT($input)); }