-
Notifications
You must be signed in to change notification settings - Fork 151
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
Automated CSS selector translation to vector form #131
Comments
Hi - I wrote this as a learning exercise, you're welcome to poke around at it and adapt if you like: https://gist.github.com/blx/e6970121d629ca2dbd49 It's pretty rough and doesn't support Example: user=> (require '[eac])
nil
user=> eac/testcss
"p#x body.blue:not(.red) #lol:first-of-type input[type=text] span:nth-child(3n + 1 )"
user=> (eac/translate-css eac/testcss)
[:p#x [:body.blue (html/but :.red)] [:#lol html/first-of-type] [:input (attr= :type "text")] [:span (html/nth-child 3 1)]] |
@blx is https://gist.github.com/Jared314/5028617 a complete one? On 24 July 2015 07:01:55 GMT+08:00, Ben Cook notifications@github.com wrote:
|
@Immortalin That doesn't currently seem to support pseudoclasses or attributes: user=> (gist/parse-css "div.blue:first-of-type input.red[type=text]")
[:div.blue :input.red] but it looks like you could add formatters for those reasonably easily if necessary! |
@blx can you give me a example? I am rather new to Clojure. |
@cgrand is it possible to expose a function/api to allow usage of css selector strings directly via Jsoup? Something like this. This would be extremely helpful as there is currently no good automated solution for translating the css selectors generator by browser plugins such as Selector Gadget, furthermore, it would be more performant as Jsoup can be utilized to parse the css selector directly. |
Hi, is there a way to automatically translate standard css selectors to the vector form? I am using a browser plugin to automatically generate them en mass to input into a scraper and it is really tedious to have to translate them manually. Thanks in advance!
The text was updated successfully, but these errors were encountered: