function lessc::compileBlock in Less CSS Preprocessor 6.3
Same name and namespace in other branches
- 6 lessc.inc.php \lessc::compileBlock()
1 call to lessc::compileBlock()
- lessc::chunk in lessphp/
lessc.inc.php
File
- lessphp/
lessc.inc.php, line 708
Class
Code
function compileBlock($rtags, $env) {
// don't render functions
// todo: this shouldn't need to happen because multiplyTags prunes them, verify
/*
foreach ($rtags as $i => $tag) {
if (preg_match('/( |^)%/', $tag))
unset($rtags[$i]);
}
*/
if (empty($rtags)) {
return '';
}
$props = 0;
// print all the visible properties
ob_start();
foreach ($env as $name => $value) {
// todo: change this, poor hack
// make a better name storage system!!! (value types are fine)
// but.. don't render special properties (blocks, vars, metadata)
if (isset($value[0]) && $name[0] != $this->vPrefix && $name != '__args') {
echo $this
->compileProperty($name, $value, 1) . "\n";
$props++;
}
}
$list = ob_get_clean();
if ($props == 0) {
return '';
}
// do some formatting
if ($props == 1) {
$list = ' ' . trim($list) . ' ';
}
return implode(", ", $rtags) . ' {' . ($props > 1 ? "\n" : '') . $list . "}\n";
}