Skip to content
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

:not selector with multiple arguments #196

Open
koedx opened this issue Sep 12, 2023 · 1 comment
Open

:not selector with multiple arguments #196

koedx opened this issue Sep 12, 2023 · 1 comment

Comments

@koedx
Copy link

koedx commented Sep 12, 2023

https://developer.mozilla.org/en-US/docs/Web/CSS/:not

The :not() pseudo-class requires a comma-separated list of one or more selectors as its argument.

Does pup's implementation not accept a comma-separated list, or am I not understanding the appropriate syntax to accomplish what I'm trying to do? Specifically, I'm trying to filter out the header & footer divs from the html I'm working with, ie.

cat example.html | pup 'div#wrap > div:not(#header, #footer)'

Is this a bug/limitation of pup? Regardless, would appreciate any guidance. Thx.

@hseg
Copy link

hseg commented Dec 11, 2023

Hit by this as well, am trying to filter out links pointing towards localhost and those needing Tor, so I want a:not([href*=localhost], [href*=.onion/]) to work -- right now am getting

Selector parsing error: Unmatched open brace '['

MDN's workaround of chaining :not()'s doesn't work either, a:not(...):not(...) yields

Selector parsing error: Expected selector indicator after ']'

EDIT: A clunky, but working workaround is to use multiple instances of pup:
pup 'a:not([href*=localhost])' | pup 'a:not([href*=.onion/])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants