pynliner icon indicating copy to clipboard operation
pynliner copied to clipboard

complex CSS selectors

Open rennat opened this issue 14 years ago • 6 comments

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?)

rennat avatar Aug 04 '11 23:08 rennat

+1 for pseudo selectors. I found out that they're not supported when I tried to zebra-stripe a table with :nth-child.

adam-p avatar Feb 08 '13 13:02 adam-p

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.

5p4k avatar Oct 13 '13 02:10 5p4k

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!

rennat avatar Oct 13 '13 22:10 rennat

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 avatar Jun 01 '16 17:06 p-himik

@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.

rennat avatar Jun 01 '16 17:06 rennat

Created #46

p-himik avatar Jun 01 '16 17:06 p-himik