pug-php / pug

Pug template engine for PHP
https://www.phug-lang.com
MIT License
391 stars 42 forks source link

Failed to read: Unclosed string (") #180

Closed sandrodz closed 6 years ago

sandrodz commented 6 years ago

Hello,

Fatal error: Uncaught Phug\ReaderException: Failed to read: Unclosed string (") encountered Near: Line: 221 Offset: 1 Position: 8417 in /www/at.dev/public/plugins/pugpress/vendor/phug/reader/src/Phug/Reader.php:913 Stack trace: #0 /www/at.dev/public/plugins/pugpress/vendor/phug/reader/src/Phug/Reader.php(795): Phug\Reader->throwException('Unclosed string...') #1 /www/at.dev/public/plugins/pugpress/vendor/phug/reader/src/Phug/Reader.php(835): Phug\Reader->readString(NULL, true) #2 /www/at.dev/public/plugins/pugpress/vendor/phug/lexer/src/Phug/Lexer/Scanner/AttributeScanner.php(88): Phug\Reader->readExpression(Array) #3 /www/at.dev/public/plugins/pugpress/vendor/phug/lexer/src/Phug/Lexer/Scanner/AttributeScanner.php(165): Phug\Lexer\Scanner\AttributeScanner->getAttributeValue(Object(Phug\Reader), Array) #4 /www/at.dev/public/plugins/pugpress/vendor/phug/lexer/src/Phug/Lexer/Scanner/AttributeScanner.php(273): Phug\Lexer\Scanner\AttributeScanner->scanParenthesesContent(Object(Phug\Lexer\State)) #5 /www/at.dev/public/plug in /www/at.dev/public/plugins/pugpress/vendor/phug/reader/src/Phug/Reader.php on line 913

I encountered an issue with the following code:

 style=isColored ? "color: #30619c" : "color: #262626")
screen shot 2017-12-13 at 7 49 46 pm

Thanks!

kylekatarnls commented 6 years ago

Confirmed, reproduced with just i(a=a ? ": " : "") strings containing colon following by space break the ternary. So until we fix it you work around by removing the space: color:#30619c

kylekatarnls commented 6 years ago

Hi, I tagged a new version of the Phug lexer, so, it should now work if you run composer update

sandrodz commented 6 years ago

@kylekatarnls thanks! but since you didn't tag new version of pug-php/pug I'm not getting a fix.

kylekatarnls commented 6 years ago

Why not? composer update should give you output like this: Updating phug/lexer (0.5.14 => 0.5.15)

sandrodz commented 6 years ago

sorry, all good :) was updating a wrong project...