/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { if ($this->debugInfo) { $output->add(self::getDebugInfo($env, $this), $this->currentFileInfo, $this->index); } $output->add(trim($this->value)); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add(sprintf('%s=', $this->key)); if (self::methodExists($this->value, 'generateCSS')) { $this->value->generateCSS($env, $output); } else { $output->add($this->value); } }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { if (!$this->escaped) { $output->add($this->quote, $this->currentFileInfo, $this->index); } $output->add($this->value); if (!$this->escaped) { $output->add($this->quote); } }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add('alpha(opacity='); if (self::methodExists($this->value, 'generateCSS')) { $this->value->generateCSS($env, $output); } else { $output->add((string) $this->value); } $output->add(')'); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add($this->toCSS($env), $this->currentFileInfo, $this->index); }
/** * Adds a chunk to the stack * * @param string $chunk * @param string $fileInfo * @param integer $index * @param mixed $mapLines * @return ILess_Output */ public function add($chunk, ILess_FileInfo $fileInfo = null, $index = 0, $mapLines = null) { // nothing to do if ($chunk == '') { return $this; } $lines = explode("\n", $chunk); $columns = end($lines); if ($fileInfo) { $inputSource = substr($this->contentsMap[$fileInfo->importedFile->getPath()], 0, $index); $sourceLines = explode("\n", $inputSource); $sourceColumns = end($sourceLines); $sourceLinesCount = count($sourceLines); $sourceColumnsLength = strlen($sourceColumns); if (!$mapLines) { $this->generator->addMapping($this->lineNumber + 1, $this->column, $sourceLinesCount, $sourceColumnsLength, $fileInfo->filename); } else { for ($i = 0, $count = count($lines); $i < $count; $i++) { $this->generator->addMapping($this->lineNumber + $i + 1, $i === 0 ? $this->column : 0, $sourceLinesCount + $i, $i === 0 ? $sourceColumnsLength : 0, $fileInfo->filename); } } } if (count($lines) === 1) { $this->column += strlen($columns); } else { $this->lineNumber += count($lines) - 1; $this->column = strlen($columns); } // add only chunk return parent::add($chunk); }
/** * Outputs the ruleset rules * * @param ILess_Environment $env * @param ILess_Output $output * @param array $rules * @return void */ public static function outputRuleset(ILess_Environment $env, ILess_Output $output, array $rules) { $env->tabLevel++; // compression if ($env->compress) { $output->add('{'); foreach ($rules as $rule) { $rule->generateCSS($env, $output); } $output->add('}'); $env->tabLevel--; return; } $tabSetStr = "\n" . str_repeat(' ', $env->tabLevel - 1); $tabRuleStr = $tabSetStr . ' '; // Non-compressed if (!count($rules)) { $output->add(' {' . $tabSetStr . '}'); return; } $output->add(' {' . $tabRuleStr); $first = true; foreach ($rules as $rule) { if ($first) { $rule->generateCSS($env, $output); $first = false; continue; } $output->add($tabRuleStr); $rule->generateCSS($env, $output); } $output->add($tabSetStr . '}'); $env->tabLevel--; }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add($this->name . ($env->compress ? ':' : ': '), $this->currentFileInfo, $this->index); try { $this->value->generateCSS($env, $output); } catch (ILess_Exception $e) { if ($this->currentFileInfo) { $e->setCurrentFile($this->currentFileInfo, $this->index); } // rethrow throw $e; } $output->add($this->important . ($this->inline || $env->lastRule && $env->compress ? '' : ';'), $this->currentFileInfo, $this->index); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { if ($env->strictUnits && !$this->unit->isSingular()) { throw new ILess_Exception_Compiler(sprintf('Multiple units in dimension. Correct the units or use the unit function. Bad unit: %s', $this->unit->toString())); } $value = $this->value; // Zero values doesn't need a unit if ($env->compress) { if ($value == 0 && $this->unit->isLength()) { $output->add($value); // no need to continue return; } elseif ($value > 0 && $value < 1 && $value[0] === '0') { $value = substr($value, 1); } } $output->add($value); // pass to unit $this->unit->generateCSS($env, $output); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add($this->toCSS($env)); }
/** * @see ILess_Node */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { if ($this->css) { $output->add('@import ', $this->currentFileInfo, $this->index); $this->path->generateCSS($env, $output); if ($this->features) { $output->add(' '); $this->features->generateCSS($env, $output); } $output->add(';'); } return $output; }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add('('); $this->value->generateCSS($env, $output); $output->add(')'); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { // handle IE filters, cannot accept shortened colors if (strpos($this->name, 'progid:') === 0) { $canShortenColors = $env->canShortenColors; $env->canShortenColors = false; } $output->add(sprintf('%s(', $this->name), $this->currentFileInfo, $this->index); for ($i = 0, $count = count($this->args); $i < $count; $i++) { $this->args[$i]->generateCSS($env, $output); if ($i + 1 < $count) { $output->add(', '); } } if (isset($canShortenColors)) { // put it back $env->canShortenColors = $canShortenColors; } $output->add(')'); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { if (count($this->numerator) >= 1) { $output->add($this->numerator[0]); } else { if (count($this->denominator) >= 1) { $output->add($this->denominator[0]); } else { if (!$env->strictUnits && $this->backupUnit) { $output->add($this->backupUnit); } } } }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add($this->name, $this->currentFileInfo, $this->index); if (count($this->rules)) { $this->outputRuleset($env, $output, $this->rules); } else { $output->add(' '); $this->value->generateCSS($env, $output); $output->add(';'); } }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { // we do not care about compression flag here, so the developer knows whats going on $output->add('/*Sorry, unable to do javascript evaluation in PHP... With men it is impossible, but not with God: for with God all things are possible. Mark 10:27*/'); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add($env->compress ? self::$outputMapCompressed[$this->value] : self::$outputMap[$this->value]); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add($this->value, $this->currentFileInfo, $this->index, $this->mapLines); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { $output->add('@media ', $this->currentFileInfo, $this->index); $this->features->generateCSS($env, $output); $this->outputRuleset($env, $output, $this->rules); }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { if (!$env->firstSelector && $this->elements[0]->combinator->value === '') { $output->add(' ', $this->currentFileInfo, $this->index); } foreach ($this->elements as $e) { /* @var $e ILess_Node_Element */ $e->generateCSS($env, $output); } }
/** * @see ILess_Node::generateCSS */ public function generateCSS(ILess_Environment $env, ILess_Output $output) { if (!$this->root) { $env->tabLevel++; } $tabRuleStr = $tabSetStr = ''; if (!$env->compress && $env->tabLevel) { $tabRuleStr = str_repeat(' ', $env->tabLevel); $tabSetStr = str_repeat(' ', $env->tabLevel - 1); } $ruleNodes = $rulesetNodes = array(); for ($i = 0, $rulesCount = count($this->rules); $i < $rulesCount; $i++) { $rule = $this->rules[$i]; if (self::propertyExists($rule, 'rules') && $rule->rules || $rule instanceof ILess_Node_Media || $rule instanceof ILess_Node_Directive || $this->root && $rule instanceof ILess_Node_Comment) { $rulesetNodes[] = $rule; } else { $ruleNodes[] = $rule; } } // If this is the root node, we don't render // a selector, or {}. if (!$this->root) { if ($this->debugInfo) { // debug? $debugInfo = self::getDebugInfo($env, $this, $tabSetStr); if ($debugInfo) { $output->add($debugInfo)->add($tabSetStr); } } for ($i = 0, $count = count($this->paths); $i < $count; $i++) { $path = $this->paths[$i]; $env->firstSelector = true; for ($j = 0, $pathCount = count($path); $j < $pathCount; $j++) { $path[$j]->generateCSS($env, $output); $env->firstSelector = false; } if ($i + 1 < $count) { $output->add($env->compress ? ',' : ",\n" . $tabSetStr); } } $output->add(($env->compress ? '{' : " {\n") . $tabRuleStr); } $rulesetNodesCount = count($rulesetNodes); $ruleNodesCount = count($ruleNodes); // Compile rules and rulesets for ($i = 0; $i < $ruleNodesCount; $i++) { $rule = $ruleNodes[$i]; // @page{ directive ends up with root elements inside it, a mix of rules and rulesets // In this instance we do not know whether it is the last property if ($i + 1 === $ruleNodesCount && (!$this->root || $rulesetNodesCount === 0 || $this->firstRoot)) { $env->lastRule = true; } $rule->generateCSS($env, $output); if (!$env->lastRule) { $output->add($env->compress ? '' : "\n" . $tabRuleStr); } else { $env->lastRule = false; } } if (!$this->root) { $output->add($env->compress ? '}' : "\n" . $tabSetStr . '}'); $env->tabLevel--; } $firstRuleset = true; for ($i = 0; $i < $rulesetNodesCount; $i++) { if ($ruleNodesCount && $firstRuleset) { $output->add($env->compress ? '' : "\n" . ($this->root ? $tabRuleStr : $tabSetStr)); } if (!$firstRuleset) { $output->add($env->compress ? '' : "\n" . ($this->root ? $tabRuleStr : $tabSetStr)); } $firstRuleset = false; $rulesetNodes[$i]->generateCSS($env, $output); } if (!$output->isEmpty() && !$env->compress && $this->firstRoot) { $output->add("\n"); } }