-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for functional pseudo-elements #29
Conversation
this is great stuff, it will be used for scrapy/scrapy#176 for sure. |
Travis CI build failed on job 17.4 which uses Python 3.1, which isn't available (anymore) in Travis CI (http://about.travis-ci.org/docs/user/ci-environment/#Python-VM-images) |
Rebased to make things tidier. |
Hi. Thanks a lot for starting this. It turns out I have pretty strong opinions on how to do this, so rather than having you jump through hoops I went ahead and wrote the thing. I didn’t use code (other than tests) from this PR, though, sorry :) Rather than having a boolean flag to enable this and have pseudo-elements be part of the "normal" tree, pseudo-elements are still in the I don’t want to encourage too much implementing pseudo-elements with XPath (as I think this is the wrong approach), but in order to still enable what Scrapy wants to do, "translator" objects now have a |
That's ok Simon, I wasn't particularly proud of it anyway ;) |
I just released cssselect 0.9.1, which is backward-incompatible with 0.9 if you use pseudo-elements with the |
Thanks for the update @SimonSapin |
Some modifications to the parser to explicitly handle pseudo-elements and functional pseudo-elements.
XPath translation happens in
xpath_xxxx_functional_pseudo_element
andxpath_xxxx_pseudo_element
which are probably not the best method name patterns.A new flag in
GenericTranslator
is used to handle these customizations or keep original behaviour.This is somewhat related to scrapy/scrapy#176 (though I'm not sure that very PR will use pseudo-elements in the end)