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%);
Anonymous
Diff:
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.
Diff:
Where can I download the 0.9.13 snapshot?
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/
On Thu, 09 Jan 2014 21:15:45 +0000 Hugo Schneider wrote:
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.
Maybe at the end of next week, will do some docu update also.
Last edit: RBRi 2014-01-12