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

Feature Request: strip tags that match a selector #74

Open
hughrawlinson opened this issue Apr 13, 2017 · 4 comments · May be fixed by #81
Open

Feature Request: strip tags that match a selector #74

hughrawlinson opened this issue Apr 13, 2017 · 4 comments · May be fixed by #81

Comments

@hughrawlinson
Copy link

Similar to grep's -v (inverse grep), I'd love an 'inverse select' option for pup. Something like:

$ echo '<div><h1>Yes</h1><p>No</p></div>' | pup -v 'p'
<div><h1>Yes</h1></div>
@ericchiang
Copy link
Owner

Yea this would be a welcome addition.

@nick-bull
Copy link

Progress on this? Best I could come up with in the meantime:

html="<h1>hi</h1><h2>there</h2>"
diff --unchanged-group-format="" \
  <(echo "$html" - | pup --indent 0 'h2') \
  <(echo "$html" - | pup --indent 0 '*')` | pup

--indent 0 is redundant in this example, but in multiline html changing indents will create no match, so I guess you could say... it makes a diff (sorry). The final pup pipe will re-indent the html for ya

@wolfgang42
Copy link

@nick-bull #81 implements this. I see that Eric has just started making commits again, hopefully he'll merge the open PRs soon and make a new release. In the meantime pulling and building my branch should get you what you need.

@frioux
Copy link

frioux commented Jan 24, 2022

I merged this into https://github.com/frioux/pup, fyi

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

Successfully merging a pull request may close this issue.

6 participants
@frioux @hughrawlinson @wolfgang42 @ericchiang @nick-bull and others