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

Problem with unescaped quote characters #15

Closed
exdeniz opened this issue Dec 3, 2017 · 7 comments
Closed

Problem with unescaped quote characters #15

exdeniz opened this issue Dec 3, 2017 · 7 comments
Labels

Comments

@exdeniz
Copy link

exdeniz commented Dec 3, 2017

Bug on line like this

background-image url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'> <circle cx='15' cy='15' r='14' fill='none' stroke='#3c3c3c' stroke-width='1'/> </svg>")

after format

background-image url('data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'> <circle cx='15' cy='15' r='14' fill='none' stroke='#3c3c3c' stroke-width='1'/> </svg>')

setting supremacy

"stylusSupremacy.insertColons": false,
  "stylusSupremacy.insertSemicolons": false,
  "stylusSupremacy.insertBraces": false,
  "stylusSupremacy.insertNewLineBetweenSelectors": true,
  "stylusSupremacy.insertLeadingZeroBeforeFraction": false,
  "stylusSupremacy.alwaysUseImport": true,
  "stylusSupremacy.alwaysUseZeroWithoutUnit": true,
  "stylusSupremacy.reduceMarginAndPaddingValues": false,
  "stylusSupremacy.insertNewLineAroundBlocks": "root",
  "stylusSupremacy.insertNewLineAroundProperties": false,
  "stylusSupremacy.insertNewLineAroundOthers": "root",
  "stylusSupremacy.sortProperties": [
    "lost-column",
    "lost-flex",
     ...
  ],
@ThisIsManta
Copy link
Owner

Does it have something to do with single/double quote conversion?

@exdeniz
Copy link
Author

exdeniz commented Dec 3, 2017

Yes, inline svg need use single.
and see first quote after url(

background-image url(''data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='003030'> <circle cx='15' cy='15' r='14' fill='none' stroke='#3c3c3c' stroke-width='1'/> </svg>'') // www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'> <circle cx='15' cy='15' r='14' fill='none' stroke='#3c3c3c' stroke-width='1'/> </svg>')

@exdeniz
Copy link
Author

exdeniz commented Dec 3, 2017

May be can add comment line before like // supremacy disable
Formatter work is correct, this is particular case.

@ThisIsManta
Copy link
Owner

ThisIsManta commented Dec 3, 2017

I think this is an exception for single-quote users. The formatter must not converting double to single quotes for url("data:image/svg+xml;utf8,<svg>....</svg>"). I'll make a patch for that real quick.

@ThisIsManta ThisIsManta added the bug label Dec 3, 2017
@ThisIsManta ThisIsManta changed the title inline SVG Problem with unescaped quote characters Dec 3, 2017
@ThisIsManta
Copy link
Owner

ThisIsManta commented Dec 3, 2017

Here's the solution:

  1. If the string starts with data:image/svg+xml;utf8,, then it will convert the outer quote chars normally and also inverse the quotes in the content (single to double or vice versa, if needed.) See background-image
  2. If the string contains the target quote char, do not convert the quotes at all. See var1
  3. Otherwise, convert the outer most quote chars (normal behavior). See var2

For example,
image

ThisIsManta pushed a commit that referenced this issue Dec 3, 2017
@ThisIsManta
Copy link
Owner

This is fixed in version 2.6.0.

Cheers!

@exdeniz
Copy link
Author

exdeniz commented Dec 3, 2017

Thank you for fix, it was really fast!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants