pynliner
pynliner copied to clipboard
complex CSS selectors
Pynliner currently fails to apply the selector element#id.class.
Other selectors that fail include adjacent sibling (a + b) and child (a > b) selectors as well as pseudo selectors (not sure if pseudo selectors should be included... thoughts anyone?)
+1 for pseudo selectors. I found out that they're not supported when I tried to zebra-stripe a table with :nth-child.
Also :not( ) isn't supported. Pynliner fails raising an exception: https://github.com/rennat/pynliner/blob/master/pynliner/soupselect.py#L103.
Until pseudo selectors get supported, I suggest Pynliner to ignore them instead of failing: a partial result is better than none. Besides, the selector could be included in a css file but not actually match any tag.
I think we should support pseudo selectors. Also any errors should log warning but continue rendering the remaining selectors. These are good improvements to make and I'm sure I'll get to them eventually but I'll also accept pull requests!
Why is not a bug anymore? It fails to apply even a selector like .class1.class2.
classes = re.findall('\.([a-zA-Z0-9_-]+)', token) in soupselect.py is definitely not a correct way to do it.
@p-himik , If you have some HTML and CSS that isn't being handled correctly, the most productive thing you can do here is to fork this repository and add a test showing the failure then open a pull request. I'll pull in failing tests if they highlight problems in pynliner so we can fix them.
Created #46