Menu

#6 Single quote replaced by double quotes

Next_Release
closed
RBRi
bug (1)
1
2020-10-31
2019-07-23
No

Hello,

I have a problem when I use your lib.
When I try to parse simple Css like this one font-style: 'times new roman', serif; your lib replaces the single quote by double quotes and give me this code font-style: "times new roman", serif;.

May I am doing something wrong?
Can you help me?

Thank you so much.

Discussion

  • Jérome LE BARON

    • labels: --> bug
     
  • RBRi

    RBRi - 2019-07-27

    Hi Jerome,

    as far as i can see you are doing nothng wrong :-)
    cssparser is at the core a parser for css files - means cssparser is able to read cssfiles and build a matching object graph. You can then do some traversal on top of the graph or whatever comes to your mind. And there is also a simple kind o dump the graph back as string functionality but this creates some kind of normalized string out of the graph. Part of normalization is to include all strings in double quotes.

    Maybe you can tell me a bit more about your use case and your requirements and i will check if i can enhance the code a bit.

     
  • Jérome LE BARON

    Hello,
    we are doing some css cleaning of the style attribute and we send something like that style="font-style: 'times new roman', serif;" your lib change the style attribute to font-style: "times new roman", serif. It causes us some problems.

     
  • Jérome LE BARON

    Hello, do you have update about that?

     
    • RBRi

      RBRi - 2019-08-24

      Sorry not really. The information about the used quotation style gets lost during the parse process.
      But you can trust the normaliztation to always use double quotes for string values.
      Why not using this and always replace the style attribute with the reformated ones using single quote.

      As an alternative i can offer a formatter option to include strings in single quotes.

       
  • Jérome LE BARON

    Hello

    Why not using this and always replace the style attribute with the reformated ones using single quote.
    This causes some problem with an html editor we are using.
    As an alternative i can offer a formatter option to include strings in single quotes.

    Yes it could be great, thank you so much.

     

    Last edit: Jérome LE BARON 2019-09-03
  • Anonymous

    Anonymous - 2020-10-31

    Sorry this was forgotten somehow. The next release will include this.

     
  • RBRi

    RBRi - 2020-10-31
    • status: open --> closed
    • assigned_to: RBRi
     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.