wassem / cssjanus

Automatically exported from code.google.com/p/cssjanus
Apache License 2.0
0 stars 0 forks source link

body { direction: ltr; } not flipped when there's a newline before the opening brace #15

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
While "body { direction: ltr; }" and "body {\ndirection:ltr;\n}" get flipped 
properly, "body\n{\ndirection: ltr;\n}" does not. See attached files for 
testcase, actual output and expected output.

This seems to be caused by line 478:
    line = TOKEN_LINES.join(lines) )

This adds TOKEN_LINES (defined as '~J~') after newlines, which means "body\n{" 
becomes "body\n~J~{" and no longer matches BODY_SELECTOR:
    BODY_SELECTOR = r'body%s{%s' % (csslex.WHITESPACE, csslex.WHITESPACE)

I suggest removing TOKEN_LINES altogether. The attached patch does this: it 
concatenates the list of lines into a single one in the main function and 
removes all traces of TOKEN_LINES.  

Original issue reported on code.google.com by roan.kat...@gmail.com on 29 Jun 2010 at 3:04

Attachments: