Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue 673: Parse error with named CSS grid lines and areas #643

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions lessc.inc.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?php

/**
* lessphp v0.5.0
* http://leafo.net/lessphp
Expand All @@ -10,7 +9,6 @@
* Licensed under MIT or GPLv3, see LICENSE
*/


/**
* The LESS compiler and parser.
*
Expand Down Expand Up @@ -1988,6 +1986,7 @@ public function __construct($fname = null) {
}

public function compile($string, $name = null) {
$string = preg_replace('/\[([\w-]+)\]/', '___$1___', $string); // Protect CSS named grids
$locale = setlocale(LC_NUMERIC, 0);
setlocale(LC_NUMERIC, "C");

Expand All @@ -2010,6 +2009,7 @@ public function compile($string, $name = null) {
$this->formatter->block($this->scope);
$out = ob_get_clean();
setlocale(LC_NUMERIC, $locale);
$out = preg_replace('/___([\w-]+)___/', '[$1]', $out); // Remove CSS named grid protections
return $out;
}

Expand Down Expand Up @@ -2449,6 +2449,8 @@ public function __construct($lessc, $sourceName = null) {
}

public function parse($buffer) {
// lessc->compile() will handle unprotecting CSS named grids.
$buffer = preg_replace('/\[([\w-]+)\]/', '___$1___', $buffer); // Protect CSS named grids
$this->count = 0;
$this->line = 1;

Expand Down