jenkins-bot has submitted this change and it was merged. Change subject: Update oyejorge/less.php to 1.7.0.10 ......................................................................
Update oyejorge/less.php to 1.7.0.10 Changelog https://github.com/oyejorge/less.php/blob/v1.7.0.10/CHANGES.md https://github.com/oyejorge/less.php/compare/v1.7.0.9...v1.7.0.10 Change-Id: Ifeec0870df1e0504be795dfb32be5ecd795325d5 --- M composer.json M composer.lock M composer/installed.json M oyejorge/less.php/CHANGES.md M oyejorge/less.php/README.md M oyejorge/less.php/bin/lessc M oyejorge/less.php/composer.json M oyejorge/less.php/lessc.inc.php M oyejorge/less.php/lib/Less/Cache.php M oyejorge/less.php/lib/Less/Exception/Chunk.php M oyejorge/less.php/lib/Less/Functions.php M oyejorge/less.php/lib/Less/Parser.php M oyejorge/less.php/lib/Less/Tree.php M oyejorge/less.php/lib/Less/Tree/Dimension.php M oyejorge/less.php/lib/Less/Tree/Import.php M oyejorge/less.php/lib/Less/Tree/Mixin/Call.php M oyejorge/less.php/lib/Less/Tree/NameValue.php M oyejorge/less.php/lib/Less/Tree/Ruleset.php M oyejorge/less.php/lib/Less/Version.php M oyejorge/less.php/lib/Less/Visitor/processExtends.php 20 files changed, 240 insertions(+), 194 deletions(-) Approvals: Reedy: Looks good to me, approved jenkins-bot: Verified diff --git a/composer.json b/composer.json index 2787cb4..65e50f3 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "monolog/monolog": "1.17.2", "nmred/kafka-php": "0.1.5", "oojs/oojs-ui": "0.15.2", - "oyejorge/less.php": "1.7.0.9", + "oyejorge/less.php": "1.7.0.10", "pear/console_getopt": "1.4.1", "pear/mail": "1.2.0", "pear/mail_mime": "1.10.0", diff --git a/composer.lock b/composer.lock index c00c463..625a84d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "7720ca220d324a1d4faedabbaa4667bd", - "content-hash": "270d312f323f4ad12254dca0c9cd3f72", + "hash": "7f3f211f67f5a592871ced813284a0a8", + "content-hash": "7f19115f07b3948409e6c52f3f391760", "packages": [ { "name": "composer/semver", @@ -442,20 +442,23 @@ }, { "name": "oyejorge/less.php", - "version": "v1.7.0.9", + "version": "v1.7.0.10", "source": { "type": "git", "url": "https://github.com/oyejorge/less.php.git", - "reference": "fb64e2f6ef647a229c50e9fa0f2076240a3484c6" + "reference": "a1e2d3c20794b37ac4d0baeb24613e579584033b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/oyejorge/less.php/zipball/fb64e2f6ef647a229c50e9fa0f2076240a3484c6", - "reference": "fb64e2f6ef647a229c50e9fa0f2076240a3484c6", + "url": "https://api.github.com/repos/oyejorge/less.php/zipball/a1e2d3c20794b37ac4d0baeb24613e579584033b", + "reference": "a1e2d3c20794b37ac4d0baeb24613e579584033b", "shasum": "" }, "require": { "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.18" }, "bin": [ "bin/lessc" @@ -497,7 +500,7 @@ "php", "stylesheet" ], - "time": "2015-09-28 01:11:47" + "time": "2015-12-30 05:47:36" }, { "name": "pear/console_getopt", diff --git a/composer/installed.json b/composer/installed.json index 7a9098e..3303b5c 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -439,67 +439,6 @@ "homepage": "https://www.mediawiki.org/wiki/CLDRPluralRuleParser" }, { - "name": "oyejorge/less.php", - "version": "v1.7.0.9", - "version_normalized": "1.7.0.9", - "source": { - "type": "git", - "url": "https://github.com/oyejorge/less.php.git", - "reference": "fb64e2f6ef647a229c50e9fa0f2076240a3484c6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/oyejorge/less.php/zipball/fb64e2f6ef647a229c50e9fa0f2076240a3484c6", - "reference": "fb64e2f6ef647a229c50e9fa0f2076240a3484c6", - "shasum": "" - }, - "require": { - "php": ">=5.3" - }, - "time": "2015-09-28 01:11:47", - "bin": [ - "bin/lessc" - ], - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-0": { - "Less": "lib/" - }, - "classmap": [ - "lessc.inc.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "Apache-2.0" - ], - "authors": [ - { - "name": "Matt Agar", - "homepage": "https://github.com/agar" - }, - { - "name": "Martin Jantošovič", - "homepage": "https://github.com/Mordred" - }, - { - "name": "Josh Schmidt", - "homepage": "https://github.com/oyejorge" - } - ], - "description": "PHP port of the Javascript version of LESS http://lesscss.org", - "homepage": "http://lessphp.gpeasy.com", - "keywords": [ - "css", - "less", - "less.js", - "lesscss", - "php", - "stylesheet" - ] - }, - { "name": "wikimedia/relpath", "version": "1.0.3", "version_normalized": "1.0.3.0", @@ -1717,5 +1656,69 @@ ], "description": "Provides library of common widgets, layouts, and windows.", "homepage": "https://www.mediawiki.org/wiki/OOjs_UI" + }, + { + "name": "oyejorge/less.php", + "version": "v1.7.0.10", + "version_normalized": "1.7.0.10", + "source": { + "type": "git", + "url": "https://github.com/oyejorge/less.php.git", + "reference": "a1e2d3c20794b37ac4d0baeb24613e579584033b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/oyejorge/less.php/zipball/a1e2d3c20794b37ac4d0baeb24613e579584033b", + "reference": "a1e2d3c20794b37ac4d0baeb24613e579584033b", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.8.18" + }, + "time": "2015-12-30 05:47:36", + "bin": [ + "bin/lessc" + ], + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-0": { + "Less": "lib/" + }, + "classmap": [ + "lessc.inc.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "Apache-2.0" + ], + "authors": [ + { + "name": "Matt Agar", + "homepage": "https://github.com/agar" + }, + { + "name": "Martin Jantošovič", + "homepage": "https://github.com/Mordred" + }, + { + "name": "Josh Schmidt", + "homepage": "https://github.com/oyejorge" + } + ], + "description": "PHP port of the Javascript version of LESS http://lesscss.org", + "homepage": "http://lessphp.gpeasy.com", + "keywords": [ + "css", + "less", + "less.js", + "lesscss", + "php", + "stylesheet" + ] } ] diff --git a/oyejorge/less.php/CHANGES.md b/oyejorge/less.php/CHANGES.md index 906a9af..610d444 100644 --- a/oyejorge/less.php/CHANGES.md +++ b/oyejorge/less.php/CHANGES.md @@ -1,6 +1,19 @@ -This is where the changelog will go for 1.7.0.9 or higher now. + + +# 1.7.0.10 + + - [All Changes](https://github.com/oyejorge/less.php/compare/v1.7.0.9...v1.7.10) + - Add indentation option + - Add 'optional' modifier for @import + - fix $color in Exception messages + - don't use set_time_limit when running cli + - take relative-url into account when building the cache filename + - urlArgs should be string no array() + - add bug-report fixtures [#6dc898f](https://github.com/oyejorge/less.php/commit/6dc898f5d75b447464906bdf19d79c2e19d95e33) + - fix #269, missing on NameValue type [#a8dac63](https://github.com/oyejorge/less.php/commit/a8dac63d93fb941c54fb78b12588abf635747c1b) # 1.7.0.9 + - [All Changes](https://github.com/oyejorge/less.php/compare/v1.7.0.8...v1.7.0.9) - Remove space at beginning of Version.php - - Revert require() paths in test interface \ No newline at end of file + - Revert require() paths in test interface diff --git a/oyejorge/less.php/README.md b/oyejorge/less.php/README.md index 1c53364..798ec0c 100644 --- a/oyejorge/less.php/README.md +++ b/oyejorge/less.php/README.md @@ -37,7 +37,7 @@ ```json { "require": { - "oyejorge/less.php": "~1.5" + "oyejorge/less.php": "~1.7.0.9" } } ``` diff --git a/oyejorge/less.php/bin/lessc b/oyejorge/less.php/bin/lessc old mode 100755 new mode 100644 diff --git a/oyejorge/less.php/composer.json b/oyejorge/less.php/composer.json index 7724e3f..fed68f1 100644 --- a/oyejorge/less.php/composer.json +++ b/oyejorge/less.php/composer.json @@ -21,6 +21,12 @@ "require": { "PHP" : ">=5.3" }, + "require-dev": { + "phpunit/phpunit": "~4.8.18" + }, + "scripts": { + "test": "phpunit" + }, "autoload": { "psr-0": { "Less": "lib/" }, "classmap": ["lessc.inc.php"] diff --git a/oyejorge/less.php/lessc.inc.php b/oyejorge/less.php/lessc.inc.php index c77a1c0..bd4bc37 100644 --- a/oyejorge/less.php/lessc.inc.php +++ b/oyejorge/less.php/lessc.inc.php @@ -1,20 +1,18 @@ <?php /** - * * This file provides the part of lessphp API (https://github.com/leafo/lessphp) * to be a drop-in replacement for following products: * - Drupal 7, by the less module v3.0+ (https://drupal.org/project/less) * - Symfony 2 - * */ // Register autoloader for non-composer installations -if (!class_exists('Less_Parser')) { - require_once dirname(__FILE__).'/lib/Less/Autoloader.php'; +if ( !class_exists( 'Less_Parser' ) ) { + require_once __DIR__ . '/lib/Less/Autoloader.php'; Less_Autoloader::register(); } -class lessc{ +class lessc { static public $VERSION = Less_Version::less_version; @@ -23,110 +21,118 @@ protected $libFunctions = array(); protected $registeredVars = array(); private $formatterName; + private $options = array(); - public function __construct($lessc=null, $sourceName=null) {} + public function __construct( $lessc=null, $sourceName=null ) {} - public function setImportDir($dirs) { + public function setImportDir( $dirs ) { $this->importDir = (array)$dirs; } - public function addImportDir($dir){ + public function addImportDir( $dir ) { $this->importDir = (array)$this->importDir; $this->importDir[] = $dir; } - public function setFormatter($name) - { + public function setFormatter( $name ) { $this->formatterName = $name; } - public function setPreserveComments($preserve) {} - public function registerFunction($name, $func) { + public function setPreserveComments( $preserve ) {} + + public function registerFunction( $name, $func ) { $this->libFunctions[$name] = $func; } - public function unregisterFunction($name) { - unset($this->libFunctions[$name]); + + public function unregisterFunction( $name ) { + unset( $this->libFunctions[$name] ); } - public function setVariables($variables){ - foreach( $variables as $name => $value ){ + public function setVariables( $variables ){ + foreach ( $variables as $name => $value ) { $this->setVariable( $name, $value ); } } - public function setVariable($name, $value){ + public function setVariable( $name, $value ) { $this->registeredVars[$name] = $value; } - public function unsetVariable($name){ + public function unsetVariable( $name ) { unset( $this->registeredVars[$name] ); } - public function setOptions($options){ - foreach( $options as $name => $value ){ + public function setOptions( $options ) { + foreach ( $options as $name => $value ) { $this->setOption( $name, $value); } } - public function setOption($name, $value){ + public function setOption( $name, $value ) { $this->options[$name] = $value; } - public function parse($buffer, $presets = array()){ + public function parse( $buffer, $presets = array() ) { - $this->setVariables($presets); + $this->setVariables( $presets ); - $parser = new Less_Parser($this->getOptions()); - $parser->setImportDirs($this->getImportDirs()); - foreach ($this->libFunctions as $name => $func) { - $parser->registerFunction($name, $func); + $parser = new Less_Parser( $this->getOptions() ); + $parser->setImportDirs( $this->getImportDirs() ); + foreach ( $this->libFunctions as $name => $func ) { + $parser->registerFunction( $name, $func ); } $parser->parse($buffer); - if( count( $this->registeredVars ) ) $parser->ModifyVars( $this->registeredVars ); + if ( count( $this->registeredVars ) ) { + $parser->ModifyVars( $this->registeredVars ); + } return $parser->getCss(); } - protected function getOptions(){ - $options = array('relativeUrls'=>false); - switch($this->formatterName){ + protected function getOptions() { + $options = array( 'relativeUrls'=>false ); + switch( $this->formatterName ) { case 'compressed': $options['compress'] = true; break; } + if (is_array($this->options)) + { + $options = array_merge($options, $this->options); + } return $options; } - protected function getImportDirs(){ + protected function getImportDirs() { $dirs_ = (array)$this->importDir; $dirs = array(); - foreach($dirs_ as $dir) { + foreach ( $dirs_ as $dir ) { $dirs[$dir] = ''; } return $dirs; } - public function compile($string, $name = null){ + public function compile( $string, $name = null ) { $oldImport = $this->importDir; $this->importDir = (array)$this->importDir; $this->allParsedFiles = array(); - $parser = new Less_Parser($this->getOptions()); - $parser->SetImportDirs($this->getImportDirs()); - if( count( $this->registeredVars ) ){ + $parser = new Less_Parser( $this->getOptions() ); + $parser->SetImportDirs( $this->getImportDirs() ); + if ( count( $this->registeredVars ) ) { $parser->ModifyVars( $this->registeredVars ); } - foreach ($this->libFunctions as $name => $func) { - $parser->registerFunction($name, $func); + foreach ( $this->libFunctions as $name => $func ) { + $parser->registerFunction( $name, $func ); } - $parser->parse($string); + $parser->parse( $string ); $out = $parser->getCss(); $parsed = Less_Parser::AllParsedFiles(); - foreach( $parsed as $file ){ - $this->addParsedFile($file); + foreach ( $parsed as $file ) { + $this->addParsedFile( $file ); } $this->importDir = $oldImport; @@ -134,46 +140,48 @@ return $out; } - public function compileFile($fname, $outFname = null) { - if (!is_readable($fname)) { - throw new Exception('load error: failed to find '.$fname); + public function compileFile( $fname, $outFname = null ) { + if ( !is_readable( $fname ) ) { + throw new Exception( 'load error: failed to find '.$fname ); } - $pi = pathinfo($fname); + $pi = pathinfo( $fname ); $oldImport = $this->importDir; $this->importDir = (array)$this->importDir; - $this->importDir[] = realpath($pi['dirname']).'/'; + $this->importDir[] = realpath( $pi['dirname'] ).'/'; $this->allParsedFiles = array(); - $this->addParsedFile($fname); + $this->addParsedFile( $fname ); - $parser = new Less_Parser($this->getOptions()); - $parser->SetImportDirs($this->getImportDirs()); - if( count( $this->registeredVars ) ) $parser->ModifyVars( $this->registeredVars ); - foreach ($this->libFunctions as $name => $func) { - $parser->registerFunction($name, $func); + $parser = new Less_Parser( $this->getOptions() ); + $parser->SetImportDirs( $this->getImportDirs() ); + if ( count( $this->registeredVars ) ) { + $parser->ModifyVars( $this->registeredVars ); } - $parser->parseFile($fname); + foreach ( $this->libFunctions as $name => $func ) { + $parser->registerFunction( $name, $func ); + } + $parser->parseFile( $fname ); $out = $parser->getCss(); $parsed = Less_Parser::AllParsedFiles(); - foreach ($parsed as $file) { - $this->addParsedFile($file); + foreach ( $parsed as $file ) { + $this->addParsedFile( $file ); } $this->importDir = $oldImport; - if ($outFname !== null) { - return file_put_contents($outFname, $out); + if ( $outFname !== null ) { + return file_put_contents( $outFname, $out ); } return $out; } - public function checkedCompile($in, $out) { - if (!is_file($out) || filemtime($in) > filemtime($out)) { + public function checkedCompile( $in, $out ) { + if ( !is_file( $out ) || filemtime( $in ) > filemtime( $out ) ) { $this->compileFile($in, $out); return true; } @@ -201,21 +209,21 @@ * @param bool $force Force rebuild? * @return array lessphp cache structure */ - public function cachedCompile($in, $force = false) { + public function cachedCompile( $in, $force = false ) { // assume no root $root = null; - if (is_string($in)) { + if ( is_string( $in ) ) { $root = $in; - } elseif (is_array($in) and isset($in['root'])) { - if ($force or ! isset($in['files'])) { + } elseif ( is_array( $in ) and isset( $in['root'] ) ) { + if ( $force or ! isset( $in['files'] ) ) { // If we are forcing a recompile or if for some reason the // structure does not contain any file information we should // specify the root to trigger a rebuild. $root = $in['root']; - } elseif (isset($in['files']) and is_array($in['files'])) { - foreach ($in['files'] as $fname => $ftime ) { - if (!file_exists($fname) or filemtime($fname) > $ftime) { + } elseif ( isset( $in['files'] ) and is_array( $in['files'] ) ) { + foreach ( $in['files'] as $fname => $ftime ) { + if ( !file_exists( $fname ) or filemtime( $fname ) > $ftime ) { // One of the files we knew about previously has changed // so we should look at our incoming root again. $root = $in['root']; @@ -229,7 +237,7 @@ return null; } - if ($root !== null) { + if ( $root !== null ) { // If we have a root value which means we should rebuild. $out = array(); $out['root'] = $root; @@ -244,15 +252,15 @@ } } - public function ccompile( $in, $out, $less = null) { - if ($less === null) { + public function ccompile( $in, $out, $less = null ) { + if ( $less === null ) { $less = new self; } - return $less->checkedCompile($in, $out); + return $less->checkedCompile( $in, $out ); } - public static function cexecute($in, $force = false, $less = null) { - if ($less === null) { + public static function cexecute( $in, $force = false, $less = null ) { + if ( $less === null ) { $less = new self; } return $less->cachedCompile($in, $force); @@ -262,7 +270,7 @@ return $this->allParsedFiles; } - protected function addParsedFile($file) { - $this->allParsedFiles[realpath($file)] = filemtime($file); + protected function addParsedFile( $file ) { + $this->allParsedFiles[realpath( $file )] = filemtime( $file ); } } diff --git a/oyejorge/less.php/lib/Less/Cache.php b/oyejorge/less.php/lib/Less/Cache.php index 8c8be39..bf5bf92 100644 --- a/oyejorge/less.php/lib/Less/Cache.php +++ b/oyejorge/less.php/lib/Less/Cache.php @@ -83,13 +83,12 @@ $hash = md5(json_encode($less_files)); $list_file = Less_Cache::$cache_dir . Less_Cache::$prefix . $hash . '.list'; - // check cached content if( !isset($parser_options['use_cache']) || $parser_options['use_cache'] === true ){ if( file_exists($list_file) ){ self::ListFiles($list_file, $list, $cached_name); - $compiled_name = self::CompiledName($list); + $compiled_name = self::CompiledName($list, $hash); // if $cached_name is the same as the $compiled name, don't regenerate if( !$cached_name || $cached_name === $compiled_name ){ @@ -109,7 +108,7 @@ return false; } - $compiled_name = self::CompiledName( $less_files ); + $compiled_name = self::CompiledName( $less_files, $hash ); $output_file = self::OutputFile($compiled_name, $parser_options ); @@ -194,7 +193,7 @@ } - private static function CompiledName( $files ){ + private static function CompiledName( $files, $extrahash ){ //save the file list $temp = array(Less_Version::cache_version); @@ -202,7 +201,7 @@ $temp[] = filemtime($file)."\t".filesize($file)."\t".$file; } - return Less_Cache::$prefix.sha1(json_encode($temp)).'.css'; + return Less_Cache::$prefix.sha1(json_encode($temp).$extrahash).'.css'; } diff --git a/oyejorge/less.php/lib/Less/Exception/Chunk.php b/oyejorge/less.php/lib/Less/Exception/Chunk.php index 9a8b829..fcce1b4 100644 --- a/oyejorge/less.php/lib/Less/Exception/Chunk.php +++ b/oyejorge/less.php/lib/Less/Exception/Chunk.php @@ -120,7 +120,7 @@ } } if ($matched) { continue; } - return $this->fail("unmatched `" + chr($cc) + "`", $currentChunkStartIndex); + return $this->fail("unmatched `" . chr($cc) . "`", $currentChunkStartIndex); // /, check for comment case 47: diff --git a/oyejorge/less.php/lib/Less/Functions.php b/oyejorge/less.php/lib/Less/Functions.php index 419bee3..a7e0057 100644 --- a/oyejorge/less.php/lib/Less/Functions.php +++ b/oyejorge/less.php/lib/Less/Functions.php @@ -739,7 +739,7 @@ public function argb($color) { if (!$color instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to argb must be a color' . ($dark instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to argb must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return new Less_Tree_Anonymous($color->toARGB()); @@ -1034,10 +1034,10 @@ public function multiply($color1 = null, $color2 = null ){ if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to multiply must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to multiply must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to multiply must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to multiply must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendMultiply'), $color1, $color2 ); @@ -1049,10 +1049,10 @@ public function screen($color1 = null, $color2 = null ){ if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to screen must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to screen must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to screen must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to screen must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendScreen'), $color1, $color2 ); @@ -1064,10 +1064,10 @@ public function overlay($color1 = null, $color2 = null){ if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to overlay must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to overlay must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to overlay must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to overlay must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendOverlay'), $color1, $color2 ); @@ -1082,10 +1082,10 @@ public function softlight($color1 = null, $color2 = null){ if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to softlight must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to softlight must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to softlight must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to softlight must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendSoftlight'), $color1, $color2 ); @@ -1104,10 +1104,10 @@ public function hardlight($color1 = null, $color2 = null){ if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to hardlight must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to hardlight must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to hardlight must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to hardlight must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendHardlight'), $color1, $color2 ); @@ -1119,10 +1119,10 @@ public function difference($color1 = null, $color2 = null) { if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to difference must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to difference must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to difference must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to difference must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendDifference'), $color1, $color2 ); @@ -1134,10 +1134,10 @@ public function exclusion( $color1 = null, $color2 = null ){ if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to exclusion must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to exclusion must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to exclusion must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to exclusion must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendExclusion'), $color1, $color2 ); @@ -1149,10 +1149,10 @@ public function average($color1 = null, $color2 = null){ if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to average must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to average must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to average must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to average must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendAverage'), $color1, $color2 ); @@ -1165,10 +1165,10 @@ public function negation($color1 = null, $color2 = null ){ if (!$color1 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The first argument to negation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The first argument to negation must be a color' . ($color1 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } if (!$color2 instanceof Less_Tree_Color) { - throw new Less_Exception_Compiler('The second argument to negation must be a color' . ($color instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); + throw new Less_Exception_Compiler('The second argument to negation must be a color' . ($color2 instanceof Less_Tree_Expression ? ' (did you forgot commas?)' : '') ); } return $this->colorBlend( array($this,'colorBlendNegation'), $color1, $color2 ); diff --git a/oyejorge/less.php/lib/Less/Parser.php b/oyejorge/less.php/lib/Less/Parser.php index 86d455f..3871eb4 100644 --- a/oyejorge/less.php/lib/Less/Parser.php +++ b/oyejorge/less.php/lib/Less/Parser.php @@ -20,7 +20,7 @@ 'strictUnits' => false, // whether units need to evaluate correctly 'strictMath' => false, // whether math has to be within parenthesis 'relativeUrls' => true, // option - whether to adjust URL's to be relative - 'urlArgs' => array(), // whether to add args into url tokens + 'urlArgs' => '', // whether to add args into url tokens 'numPrecision' => 8, 'import_dirs' => array(), @@ -34,6 +34,8 @@ 'sourceMapBasepath' => null, 'sourceMapWriteTo' => null, 'sourceMapURL' => null, + + 'indentation' => ' ', 'plugins' => array(), @@ -87,7 +89,7 @@ // mbstring.func_overload > 1 bugfix // The encoding value must be set for each source file, // therefore, to conserve resources and improve the speed of this design is taken here - if (ini_get('mbstring.func_overload')) { + if (ini_get('mbstring.func_overload')) { $this->mb_internal_encoding = ini_get('mbstring.internal_encoding'); @ini_set('mbstring.internal_encoding', 'ascii'); } @@ -220,7 +222,7 @@ @ini_set('precision',$precision); setlocale(LC_NUMERIC, $locale); - // If you previously defined $this->mb_internal_encoding + // If you previously defined $this->mb_internal_encoding // is required to return the encoding as it was before if ($this->mb_internal_encoding != '') { @ini_set("mbstring.internal_encoding", $this->mb_internal_encoding); @@ -1989,7 +1991,7 @@ } private function parseImportOption(){ - $opt = $this->MatchReg('/\\G(less|css|multiple|once|inline|reference)/'); + $opt = $this->MatchReg('/\\G(less|css|multiple|once|inline|reference|optional)/'); if( $opt ){ return $opt[1]; } @@ -2623,5 +2625,3 @@ } } - - diff --git a/oyejorge/less.php/lib/Less/Tree.php b/oyejorge/less.php/lib/Less/Tree.php index 0de1b40..6fb104b 100644 --- a/oyejorge/less.php/lib/Less/Tree.php +++ b/oyejorge/less.php/lib/Less/Tree.php @@ -49,8 +49,8 @@ // Non-compressed - $tabSetStr = "\n".str_repeat( ' ' , Less_Environment::$tabLevel-1 ); - $tabRuleStr = $tabSetStr.' '; + $tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'] , Less_Environment::$tabLevel-1 ); + $tabRuleStr = $tabSetStr.Less_Parser::$options['indentation']; $output->add( " {" ); for($i = 0; $i < $ruleCnt; $i++ ){ @@ -87,4 +87,4 @@ return $obj; } -} \ No newline at end of file +} diff --git a/oyejorge/less.php/lib/Less/Tree/Dimension.php b/oyejorge/less.php/lib/Less/Tree/Dimension.php index b693f57..2bfb9d5 100644 --- a/oyejorge/less.php/lib/Less/Tree/Dimension.php +++ b/oyejorge/less.php/lib/Less/Tree/Dimension.php @@ -98,7 +98,7 @@ $other = $other->convertTo( $this->unit->usedUnits()); if( Less_Parser::$options['strictUnits'] && $other->unit->toString() !== $unit->toCSS() ){ - throw new Less_Exception_Compiler("Incompatible units. Change the units or use the unit function. Bad units: '".$unit->toString() . "' and ".$other->unit->toString()+"'."); + throw new Less_Exception_Compiler("Incompatible units. Change the units or use the unit function. Bad units: '" . $unit->toString() . "' and " . $other->unit->toString() . "'."); } $value = Less_Functions::operate( $op, $this->value, $other->value); diff --git a/oyejorge/less.php/lib/Less/Tree/Import.php b/oyejorge/less.php/lib/Less/Tree/Import.php index e327b75..9730d43 100644 --- a/oyejorge/less.php/lib/Less/Tree/Import.php +++ b/oyejorge/less.php/lib/Less/Tree/Import.php @@ -182,6 +182,11 @@ return array( $contents ); } + // optional (need to be before "CSS" to support optional CSS imports. CSS should be checked only if empty($this->currentFileInfo)) + if( isset($this->options['optional']) && $this->options['optional'] && !file_exists($full_path) && (!$evald->css || !empty($this->currentFileInfo))) { + return array(); + } + // css ? if( $evald->css ){ @@ -304,4 +309,3 @@ } } - diff --git a/oyejorge/less.php/lib/Less/Tree/Mixin/Call.php b/oyejorge/less.php/lib/Less/Tree/Mixin/Call.php index d7e2a13..04eb426 100644 --- a/oyejorge/less.php/lib/Less/Tree/Mixin/Call.php +++ b/oyejorge/less.php/lib/Less/Tree/Mixin/Call.php @@ -107,7 +107,7 @@ } else { $defaultResult = $defTrue; if( ($count[$defTrue] + $count[$defFalse]) > 1 ){ - throw new Exception( 'Ambiguous use of `default()` found when matching for `'. $this->format($args) + '`' ); + throw new Exception( 'Ambiguous use of `default()` found when matching for `' . $this->format($args) . '`' ); } } @@ -160,12 +160,12 @@ foreach($args as $a){ $argValue = ''; if( $a['name'] ){ - $argValue += $a['name']+':'; + $argValue .= $a['name'] . ':'; } if( is_object($a['value']) ){ - $argValue += $a['value']->toCSS(); + $argValue .= $a['value']->toCSS(); }else{ - $argValue += '???'; + $argValue .= '???'; } $message[] = $argValue; } diff --git a/oyejorge/less.php/lib/Less/Tree/NameValue.php b/oyejorge/less.php/lib/Less/Tree/NameValue.php index e65737c..31cbe03 100644 --- a/oyejorge/less.php/lib/Less/Tree/NameValue.php +++ b/oyejorge/less.php/lib/Less/Tree/NameValue.php @@ -17,6 +17,7 @@ public $index; public $currentFileInfo; public $type = 'NameValue'; + public $important = ''; public function __construct($name, $value = null, $index = null, $currentFileInfo = null ){ $this->name = $name; @@ -31,6 +32,7 @@ $this->name . Less_Environment::$_outputMap[': '] . $this->value + . $this->important . (((Less_Environment::$lastRule && Less_Parser::$options['compress'])) ? "" : ";") , $this->currentFileInfo, $this->index); } @@ -38,4 +40,12 @@ public function compile ($env){ return $this; } + + public function makeImportant(){ + $new = new Less_Tree_NameValue($this->name, $this->value, $this->index, $this->currentFileInfo); + $new->important = ' !important'; + return $new; + } + + } diff --git a/oyejorge/less.php/lib/Less/Tree/Ruleset.php b/oyejorge/less.php/lib/Less/Tree/Ruleset.php index 93d3d6b..9f9eb1b 100644 --- a/oyejorge/less.php/lib/Less/Tree/Ruleset.php +++ b/oyejorge/less.php/lib/Less/Tree/Ruleset.php @@ -264,7 +264,7 @@ $important_rules = array(); foreach($this->rules as $rule){ - if( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset ){ + if( $rule instanceof Less_Tree_Rule || $rule instanceof Less_Tree_Ruleset || $rule instanceof Less_Tree_NameValue ){ $important_rules[] = $rule->makeImportant(); }else{ $important_rules[] = $rule; @@ -365,8 +365,8 @@ $tabRuleStr = $tabSetStr = ''; if( !Less_Parser::$options['compress'] ){ if( Less_Environment::$tabLevel ){ - $tabRuleStr = "\n".str_repeat( ' ' , Less_Environment::$tabLevel ); - $tabSetStr = "\n".str_repeat( ' ' , Less_Environment::$tabLevel-1 ); + $tabRuleStr = "\n".str_repeat( Less_Parser::$options['indentation'] , Less_Environment::$tabLevel ); + $tabSetStr = "\n".str_repeat( Less_Parser::$options['indentation'] , Less_Environment::$tabLevel-1 ); }else{ $tabSetStr = $tabRuleStr = "\n"; } diff --git a/oyejorge/less.php/lib/Less/Version.php b/oyejorge/less.php/lib/Less/Version.php index 704ec6e..ad03db4 100644 --- a/oyejorge/less.php/lib/Less/Version.php +++ b/oyejorge/less.php/lib/Less/Version.php @@ -8,8 +8,8 @@ */ class Less_Version{ - const version = '1.7.0.9'; // The current build number of less.php - const less_version = '1.7'; // The less.js version that this build should be compatible with - const cache_version = '170'; // The parser cache version + const version = '1.7.0.10'; // The current build number of less.php + const less_version = '1.7.0'; // The less.js version that this build should be compatible with + const cache_version = '170'; // The parser cache version } diff --git a/oyejorge/less.php/lib/Less/Visitor/processExtends.php b/oyejorge/less.php/lib/Less/Visitor/processExtends.php index c01f9c5..d076cbb 100644 --- a/oyejorge/less.php/lib/Less/Visitor/processExtends.php +++ b/oyejorge/less.php/lib/Less/Visitor/processExtends.php @@ -112,7 +112,7 @@ $selectorTwo = "{unable to calculate}"; } - throw new Less_Exception_Parser("extend circular reference detected. One of the circular extends is currently:"+$selectorOne+":extend(" + $selectorTwo+")"); + throw new Less_Exception_Parser("extend circular reference detected. One of the circular extends is currently:" . $selectorOne . ":extend(" . $selectorTwo . ")"); } // now process the new extends on the existing rules so that we can handle a extending b extending c ectending d extending e... -- To view, visit https://gerrit.wikimedia.org/r/266074 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ifeec0870df1e0504be795dfb32be5ecd795325d5 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/vendor Gerrit-Branch: master Gerrit-Owner: Paladox <thomasmulhall...@yahoo.com> Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org> Gerrit-Reviewer: Legoktm <legoktm.wikipe...@gmail.com> Gerrit-Reviewer: Ori.livneh <o...@wikimedia.org> Gerrit-Reviewer: Paladox <thomasmulhall...@yahoo.com> Gerrit-Reviewer: Reedy <re...@wikimedia.org> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits