Migrate from GitHub to SourceForge with this tool. Check out all of SourceForge's recent improvements.
Close

#45 Parser is removing inner whitespaces in funcitons.

0.9.12
closed
RBRi
whitespace (1)
1
2015-07-25
2014-01-08
No

I noticed the change note for version 0.9.10 "CSS3: When parsing function arguments now the (inner) whitespace is preserved." but it still removes whitespaces.

code:

CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
CSSStyleSheet styleSheet = parser.parseStyleSheet(new InputSource(new StringReader(css)), null, null);
CSSRuleList ruleList = styleSheet.getCssRules();
for (int i = 0; i < ruleList.getLength(); i++) {
                CSSRule rule = ruleList.item(i);
                if (rule instanceof CSSStyleRule) {
                    CSSStyleDeclaration declaration = ((CSSStyleRule) rule)
                            .getStyle();
                    String selector = ((CSSStyleRule) rule).getSelectorText();
                    for (int j = 0; j < declaration.getLength(); j++) {
                        String property = declaration.item(j);
                        String value = declaration.getPropertyValue(property);

                    }
                }
            }

input:

*.test {
  padding: 0px 5px 6px 7px;
  background-image: url(teste/teste.png);
  background: linear-gradient(to right,
    rgba(0, 65, 119, 1) 0%,
    rgba(5, 94, 186, 1) 51%,
    rgba(5, 94, 186, 1) 100%);
}

property value for background:

linear-gradient(toright,rgba(0,65,119,1)0%,rgba(5,94,186,1)51%,rgba(5,94,186,1)100%);

Discussion

  • RBRi

    RBRi - 2014-01-08
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
    
     I noticed the change note for version 0.9.10 "CSS3: When parsing function arguments now the (inner) whitespace is preserved." but it still removes whitespaces.
    
    • status: open --> accepted
     
  • RBRi

    RBRi - 2014-01-09

    Hi Hugo,

    the change log was a bit misleading, the change was only done for pseudo functions. For 'normal' functions i have changed the way the parsed function will be translated back to an string a bit. Now the string contains delimiting blanks at the usual places. Hope this works for you.
    A new 0.9.13 snapshot is available. Please check and report back.

     
  • RBRi

    RBRi - 2014-01-09
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,3 @@
    -
     I noticed the change note for version 0.9.10 "CSS3: When parsing function arguments now the (inner) whitespace is preserved." but it still removes whitespaces.
    
     code:
    
    • status: accepted --> pending
     
  • Hugo Schneider

    Hugo Schneider - 2014-01-09

    Where can I download the 0.9.13 snapshot?

     
    • RBRi

      RBRi - 2014-01-09

      Usually you can reference it via maven from the sonatype snapshot repository or do a direct download from

      http://oss.sonatype.org/content/repositories/snapshots/net/sourceforge/cssparser/cssparser/0.9.13-SNAPSHOT/

      RBRi
      

      On Thu, 09 Jan 2014 21:15:45 +0000 Hugo Schneider wrote:

      Where can I download the 0.9.13 snapshot?


      [bugs:#45] Parser is removing inner whitespaces in funcitons.

      Status: pending
      Labels: whitespace
      Created: Wed Jan 08, 2014 03:48 PM UTC by Hugo Schneider
      Last Updated: Thu Jan 09, 2014 07:35 PM UTC
      Owner: nobody

      I noticed the change note for version 0.9.10 "CSS3: When parsing function arguments now the (inner) whitespace is preserved." but it still removes whitespaces.

      code:

      ~~~~~~
      CSSOMParser parser = new CSSOMParser(new SACParserCSS3());
      CSSStyleSheet styleSheet = parser.parseStyleSheet(new InputSource(new StringReader(css)), null, null);
      CSSRuleList ruleList = styleSheet.getCssRules();
      for (int i = 0; i < ruleList.getLength(); i++) {
      CSSRule rule = ruleList.item(i);
      if (rule instanceof CSSStyleRule) {
      CSSStyleDeclaration declaration = ((CSSStyleRule) rule)
      .getStyle();
      String selector = ((CSSStyleRule) rule).getSelectorText();
      for (int j = 0; j < declaration.getLength(); j++) {
      String property = declaration.item(j);
      String value = declaration.getPropertyValue(property);

                    }
                }
            }
      

      ~~~~~~

      input:

      ~~~~~~
      *.test {
      padding: 0px 5px 6px 7px;
      background-image: url(teste/teste.png);
      background: linear-gradient(to right,
      rgba(0, 65, 119, 1) 0%,
      rgba(5, 94, 186, 1) 51%,
      rgba(5, 94, 186, 1) 100%);
      }
      ~~~~~~

      property value for background:

      ~~~~~~
      linear-gradient(toright,rgba(0,65,119,1)0%,rgba(5,94,186,1)51%,rgba(5,94,186,1)100%);
      ~~~~~~


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/cssparser/bugs/45/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • Hugo Schneider

    Hugo Schneider - 2014-01-10

    It worked fine. It would be really nice to have a 0.9.13 stable version in maven soon.
    By the way, which repository can I use to get stable versions. In standard repository I still don't have the version 0.9.12.

    Any way, thanks a lot for you help. Nice implementation.

     
    • RBRi

      RBRi - 2014-01-12

      Maybe at the end of next week, will do some docu update also.

      RBRi
      
       
      Last edit: RBRi 2014-01-12
  • RBRi

    RBRi - 2014-01-12
    • status: pending --> closed
     
  • RBRi

    RBRi - 2015-07-25
    • assigned_to: RBRi
     

Anonymous
Anonymous

Cancel  Add attachments