-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support libsass string quotes in the c/js api bindings. #1006
base: master
Are you sure you want to change the base?
Conversation
One reason why it fails is because quoted flag gets discarded from time to time... |
I'm jumping on a plane to SF in a couple hours, I'll take a look at a Regards, On Fri, Jun 19, 2015 at 9:56 PM, Marcin Cieślak [email protected]
|
Well, basically quoted string support in |
} | ||
}); | ||
|
||
assert.equal(result.css.toString().trim(), '.swapped { result: asdf, "qwerty"; }'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this result: .swapped {\n result: asdf, "qwerty"; }
acceptable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that seems right.
C SASS API kind of expects that a quoted string will be, ... well, quoted. So it's not just a flag to be set, one actually needs to convert the |
I have prepared an early set of changes to libsass to make quoted strings work:
|
@chriseppstein Can you try applying sass/libsass#1289 to libsass? May not fix all quoted-vs-unquoted string issues, but certainly lets us pass them over to node and back. |
@chriseppstein @saper IMO the merged PR on libsass side done by @saper does the correct thing. I can also give you a little background info why we have two string types (ATM). Strings that appear in sass are not always unquoted. There are "instances" that will always remain static (String_Constant) up to the output (preserving white-space and "comments" too). That's probably why you always want to deal with String_Quoted on the C-API side (looks like it simply never got implemented). String_Quoted should work pretty straight forward from there on. You pass the "parsed" string to the constructor and it will be unquoted internally (storing the unquoted value and the quotemark flag). As a side note, I'm getting more confident that we could use a bool flag for the quotemark. We previousely had wrongly parsed some String_Constants as String_Quotes, which made it necessary to preserve the actual quotemark to pass the specs. Now we parse more of them correctly as String_Constant and should be able to get rid of explicitly storing the quotemark char, and instead always rely on autoquote rules. To get autoquote behavior (meaning we detect the best quotechar), you can set quotemark char to |
Ah now I start to understand. So maybe "String_Quoted" should not be derived class of String_Constant? Are they in some circumstances interchangeable? Because in that case we should use common base class (I can see there is "String")... need to read more... |
6c128d9
to
1e4bba8
Compare
Code: Fixes dynamic exception as per C++11 specs
This code compiles but the tests fail and I'm not sure why -- I think it might be a libsass bug. I could use some help debugging it.