added blade comments and documentation.

This commit is contained in:
Taylor Otwell
2012-04-10 11:46:55 -05:00
parent 222383c83b
commit 7d5b6b3748
3 changed files with 25 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ class Blade {
*/
protected static $compilers = array(
'layouts',
'comments',
'echos',
'forelse',
'empty',
@@ -152,6 +153,19 @@ class Blade {
return str_replace(array("('", "')"), '', $matches[1]);
}
/**
* Rewrites Blade comments into PHP comments.
*
* @param string $value
* @return string
*/
protected static function compile_comments($value)
{
$value = preg_replace('/\{\{--(.+?)(--\}\})?\n/', "<?php // $1 ?>", $value);
return preg_replace('/\{\{--((.|\s)*?)--\}\}/', "<?php /* $1 */ ?>\n", $value);
}
/**
* Rewrites Blade echo statements into PHP echo statements.
*